We would like to know how to copy one array from another array.
public class Main { public static void main(String[] args) { int[] intArray = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; /* www . j ava 2 s . co m*/ int[] arrayCopy = new int[intArray.length]; System.arraycopy(intArray, 0, arrayCopy, 0, intArray.length); for (int i = 0; i < arrayCopy.length; i++) System.out.println(arrayCopy[i]); } }
The code above generates the following result.