public class Arraycopytest
{
public static void Main (string[] args)
{
Static initialization of two arrays of different lengths
int src[] = {1,2,3,4,5,6};
int dest[] = {10,9,8,7,6,5,4,3,2,1};
Copy the 4 elements of the array src into the array dest
System.arraycopy (src,1,dest,2,4);
Output array dest
for (int i=0;i<10;i++)
{
System.out.println (Dest[i]);
}
}
}//arraycopy (object src, int srcstartindex, object dest, int deststartindex, int length)
Copies an array from the specified source array, starting at the specified location and ending at the specified position in the destination array.
Srcstartindex: The position of the first element in the original array to begin copying
Deststartindex: The position of the first element in the destination array to begin replacing
Length: The number of elements to copy is transferred from: http://shylx123.blog.51cto.com/2081576/538540
[Java] arraycopy array copy (GO)