Arrays common method

Arrays common methods:

Package com.java.base3.Practice; 

Import java.util.Arrays; 

public  class ArraysTest {
     public  static  void main (String [] args) {
         int [] = {ARR. 1, 2,. 3,. 4 };
         int [] of arr1 {. 1 =,. 3, 2,. 4 }; 

        // that Arrays.equals whether the two numbers are equal compare 
        Boolean isEquals = that Arrays.equals (ARR, of arr1); 
        ; System.out.println (isEquals) 

        // of Arrays.toString information output array 
        System.out.println (of Arrays.toString (of arr1)); 

        // the specified value into the array filled 
        Arrays.fill (ARR, 99 );
        System.out.println (of Arrays.toString (ARR));

        // quicksort 
        Arrays.sort (of arr1); 
        System.out.println (of Arrays.toString (of arr1)); 

        // index location query 
        int [] = {array2 10, 30, 50, 100, 256, 777, 787, 666 };
         int index = Arrays.binarySearch (array2, 90 );
         IF (index> = 0 ) { 
            System.out.println ( "index position 50 is:" + index); 
        } the else  IF (index <0 ) { 
            System.out.println ( "Sorry, this index is not within the location" ); 
        } 
    } 
}

 

Guess you like

Origin www.cnblogs.com/lizhen1412/p/11184000.html