public static int[] copyOf(int[] original, int newLength) { int[] copy = new int[newLength]; System.arraycopy(original, 0, copy, 0, Math.min(original.length, newLength)); return copy; } 首先new一个新数组 然后copy过去 return这个新数组 int[] strArray = new int[] {1,2,…