package chapter5; /** * 拷贝数组 * System.arraycopy() */ public class Example10 { public static void main(String[] args) { int[] srcArray = {10 ,11, 12, 13, 14, 15, 16}; int[] toArray = {20, 21, 22, 23, 24, 25, 26, 27}; System.arraycopy(srcArray, 2, toArray, 3, 4); System.out.println("拷贝后的数组元素为:"); for (int i = 0; i < toArray.length; i++) { System.out.println("i : " + toArray[i]); } } }