Arrays

public static void test2(){
//判断两个数据是否相等
int[] a = new int[]{1,2,3,14,5,21,20,8};
int[] b = new int[]{1,2,3,4,5,6,7,8};
System.out.println(Arrays.equals(a, b));  //result : true;
System.out.println(Arrays.toString(b));
int[] c = Arrays.copyOf(a, 10);  //复制数据元素到c数据当中
System.out.println(Arrays.toString(c));
Arrays.fill(a, 0,4,1);  //替换值
System.out.println(Arrays.toString(a));
Arrays.sort(a);  //排序
System.out.println(Arrays.toString(a));
}

你可能感兴趣的:(C++,c,C#)