copyofrange专题

System.arraycopy和Arrays.copyOfRange的见解(笔记)

int [] src=new int[]{1,2,3,4,5,6,7,8,9,10}; int [] dest=new int[6]; System.arraycopy(src, 2, dest, 5, 1); //从src中的第2个位置到dest的第5个位置;总数为1个 dest=Arrays.copyOfRange(src, 2, 4); //从src中的第2个位置