Check out example codes for "java array copy". It will help you in understanding the concepts better.

Code Example 1

int[] a = {1,2,3,4,5};
int[] b = Arrays.copyOf(a, a.length);

Code Example 2

// Shallow copy
int[] src = {1,2,3,4,5};
int[] dst = Arrays.copyOf(src, src.length);

// Deep copy
int[] dst2 = new int[src.length];
for(int i = 0; i < src.length; i++){
	dst2[i] = src[i];
}

Code Example 3

int a[] = {1, 8, 3}; 
  
// Copy elements of a[] to b[] 
int b[] = a.clone();

Code Example 4

// 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);

Learn ReactJs, React Native from akashmittal.com