- public class TestArrays
- {
- public static void main(String[] args)
- {
- int[] array = new int[]{ 1, 3, 7,5, 4,7, 6};
- int[] newArr = Arrays.copyOf(array, 6);
- int[] newArr3 = Arrays.copyOf(array, 3);
- int[] newArr2 = Arrays.copyOfRange(array, 2, 9);
- Arrays.sort(array);
-
- System.out.println(Arrays.toString(array));
- int pos = Arrays.binarySearch(array, 7);
- System.out.println(pos);
- }
本文转自 glblong 51CTO博客,原文链接:http://blog.51cto.com/glblong/1186826,如需转载请自行联系原作者