Use this quick approach for copying an array in Java via System.arraycopy, as shown below:
int[] array = {1, 23, 5}; int[] copiedArray = new int[3]; System.arraycopy(array, 0, copiedArray, 0, 3);