Explain function system.arraycopy() ?
Although copying an array isn't particularly hard, it is an operation that advantages from a native implementation. Thus java.lang.System
involves a static System.arraycopy()
techniques you can use to copy one array to another.
public static void arraycopy(Object source, int sourcePosition,
Object destination, int destinationPosition, int numberOfElements)
System.arraycopy()
copies numberOfElements
elements from the array source
, beginning with the element at sourcePosition
, to the array destination
starting at destinationPosition
. The destination
array must already exist while System.arraycopy()
is called. The technique does not create it. The source
and destination
arrays must be of the same type.
For example,
int[] unicode = new int[65536];
for (int i = 0; i < unicode.length; i++) {
unicode[i] = i;
}
int[] latin1 = new int[256];
System.arraycopy(unicode, 0, latin1, 0, 256);