Copying arrays/assigning the 'value' of the array to another.

Code:
int[] aCopy = new int[a.length];
for (int i = 0; i < a.length; i++)
aCopy[i] = a[i];

Is this the way to 'copy' an array? Basically, I want the elements inside the the array a to be copied or assigned to the array aCopy.

Answers and Replies

Mark44
Mentor
This should work. Try it out and see.