The Java.util.Arrays class makes it easy to manipulate an array, and all of the methods it provides are static. Has the following features:
1. Elements inside the direct output array (Java Core volume- array is a data structure )
2 Assigning a value to an array: through the fill method.
2 sorting an array: By the sort method , in ascending order.
2 Comparing arrays: compares the values of elements in an array by the Equals method.
2 Finding array elements: The binarysearch method can be used to perform binary lookups of sorted arrays.
Arrays.fill () method;
Usage 1: Accepts 2 parameters
Arrays.fill (A1, value);
Note: A1 is an array variable, and value is the values of the element data type in a A1, which acts: each element in the fill A1 array is value
For example:
boolean[] A1 = new boolean[5];
Arrays.fill (a1,true);
Result a1[] = {True,true,true,true,true};
Usage 2: Accept 4 parameters: Fill out
For example:
The first parameter refers to an array of operations, the second and third refers to the insertion of a fourth parameter in an area of the array, the second parameter refers to the starting element subscript (including the subscript), the third parameter refers to the end subscript (without the subscript), note: The array subscript for Java starts with 0
Application of arrays class in Java