Fast copying an array

There is a fast native method available in the java.lang.System class: arraycopy().
It can be used to copy a region of one array to another. If an array of objects
is copied, only the references are copied. arraycopy() does not allocate memory
for the destination array. Make sure you have allocated enough memory for the
destination array to hold the copied region.

This is its signature:
arraycopy(Object src, int srcOffset, Object dst, int dstOffset, int count)

Following example demonstrates the use:

public class Main
{
   public static void main(String []args) {
      int [] src = { 1, 2, 3, 4, 5, 6, 7, 8 };
      int [] dst = { 0, 0, 0, 0, 0, 0, 0, 0 };
 
      System.arraycopy(src, 2, dst, 1, 3);
   
      printArray(src);
      printArray(dst); 
   }
 
   public static void printArray(int []array) {
      for (int i=0; i<array.length; i++) {
         System.out.print(array[i] + " ");
      }
      System.out.println();
   }
}

outputs:

1 2 3 4 5 6 7 8 
0 3 4 5 0 0 0 0