This code example uses the arraycopy() function from the System class to copy the values of one array to another array.
import java.util.Arrays;
public class SystemClassCopyArray {
public static void main(String[] args) {
int[] srcArray = {1, 2, 3, 4, 5};
int[] destArray = {10, 9, 8 ,7 ,6};
System.arraycopy(srcArray, 2, destArray, 2, 3);
System.out.println(Arrays.toString(destArray));
}
}
[10, 9, 3, 4, 5]