**/* * @param src the source array.源数组 * @param srcPos starting position in the source array.源数组要复制的起始位置 * @param dest the destination array.目标数组(将原数组复制到目标数组) * @param destPos starting position in the destination data.目标数组起始位置(从目标数组的哪个下标开始复制操作) * @pa…
当我还年幼的时候,我很任性,复制数组也是,写一个for循环,来回倒腾,后来长大了,就发现了System.arraycopy的好处. 为了测试俩者的区别我写了一个简单赋值int[100000]的程序来对比,并且中间使用了nanoTime来计算时间差: 程序如下: int[] a = new int[100000]; for(int i=0;i<a.length;i++){ a[i] = i; } int[] b = new int[100000]; int[] c = new int[100000…
public class Shuzufuzhi { public static void main(String args[]) { int myArray[]={1,2,3,4,5,6}; int yourArray[]={10,9,8,7,6,5,4,3,2,1}; int Array3 []=new int [myArray.length+yourArray.length]; System.arraycopy(myArray, 0,Array3,0,myArray.length…