Use Arrays.copyOf() to make a copy of an array. It’s useful for preserving original data.
Source Code
int[] original = {1, 2, 3, 4, 5};
int[] copied = Arrays.copyOf(original, original.length);
System.out.println("Copied Array: " + Arrays.toString(copied));