1// Shallow copy
2int[] src = {1,2,3,4,5};
3int[] dst = Arrays.copyOf(src, src.length);
4
5// Deep copy
6int[] dst2 = new int[src.length];
7for(int i = 0; i < src.length; i++){
8 dst2[i] = src[i];
9}
1int[] src = new int[]{1,2,3,4,5};
2int[] dest = new int[5];
3
4System.arraycopy( src, 0, dest, 0, src.length );