int[] src = new int[]{1,2,3,4,5};
int[] dest = new int[5];
System.arraycopy( src, 0, dest, 0, src.length );
public static void arraycopy(Object source_arr, int sourcePos,
Object dest_arr, int destPos,
int len)
/* Parameters :
source_arr : array to be copied from
sourcePos : starting position in source array from where to copy
dest_arr : array to be copied in
destPos : starting position in destination array, where to copy in
len : total no. of components to be copied
*/
int a[] = { 1, 8, 3 };
// Copying elements of a[] to b[]
int b[] = a.clone()
// method
public static int [] copyArray(int [] arr){
int [] copyArr = new int[arr.length];
for (int i = 0; i < copyArr.length; i++){
copyArr[i] = arr[i];
}
return copyArr;
}
// Arrays. method
int[] copyCat = Arrays.copyOf(arr, arr.length);
// System
System.arraycopy(x,0,y,0,5); // 5 is array's length
// clone
y = x.clone();
public static void arraycopy(Object src, int srcPos, Object dest,
int destPos, int length)
public static int[] copyOf(int[] original, int newLength)
public static int[] copyOfRange(int[] original, int from, int to)