JAVA数组的method------JAVA入门基础教程

import java.util.Arrays;

public class Compare
{
    public static void main(String[] args)
    {
        int[] a = {1,2,3,4,5};
        int[] b = {1,2,3,4,5};
        boolean are = Arrays.equals(a,b);
        System.out.println(are);
        Arrays.fill(a,10);
        System.out.println(Arrays.toString(a));
        int[] arr3 = new int[]{34,54,3,2,65,7,34,5,76,34,67};
        Arrays.sort(arr3);
        System.out.println(Arrays.toString(arr3));
        int index = Arrays.binarySearch(arr3,15);
        if(index >= 0)
        {
            System.out.println("找到了"+index);
        }
        else
        {
            System.out.println("没找到");
        }
    }
}

你可能感兴趣的:(JAVA随手写,java,开发语言,排序算法,数据结构,算法)