How to copy an array
public class Main {
/**
* Lists the system properties
*/
public void copyArrayExample() {
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 <>
System.out.println(arrayCopy[i]);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
new Main().copyArrayExample();
}
}
0 comments: