I want to copy a large array of integer values say form array a
to array b
. I have found a couple of ways to do this, including:
int[] a = new int[]{1,2,3,4,5};
int[] b = new int[5];
System.arraycopy( a, 0, b, 0, a.length );
and
int[] a = new int[]{1,2,3,4,5};
int[] b = (int[])a.clone();
Since this is done on a mobile device i want to be able to do it most efficiently.
Please tell me the best way to do this.