Copy an array
public class Main {
public static void main(String[] args) {
int[] intArray = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
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]);
}
}
/*
1
2
3
4
5
6
7
8
9
0
*/
Related examples in the same category