Java learning notes-Arrays, learning notes-arrays
Common Arrays Methods
Arrays. toString (int [] a) method -------> the return type is String, which can be used to generate printable representation of the array. This avoids reading array values cyclically for printing.
Arrays. sort (int [] a) method -------> used to sort Arrays
Arrays. fill (int [] a, int val) method -------> used to fill the array with the val Value
Arrays. copyOfRange (int [] original, int from, int to) method -------> copy an array from the from (inclusive) to (excluded) Location
Arrays. copyOf (int [] original, int newLength) method -------> truncates or expands an array (add 0)
Arrays. binarySearch (int [] a, int key) method -------> Search for a key using the binary method
Arrays. asList (T... a) method -------> converts a continuous object or basic type to List, such as Arrays. adList (,), but in this case, its underlying representation is an array, so the size cannot be adjusted. If you try to use the add () or delete () method to add a delete element, the "Unsupported Operation" error is returned.
For more information, see the API documentation.