This may be a stupid question, but how do you copy the content of one array to another.
I tried many different ways but it keep give the location of the pointer in memory rather than the right data.
Here is what I tried:
Code:
static double[] cloneArray(double original[], int n) {
double[] temp = new double[n];
for (int i = 0; i < n; i++) {
temp[i] = original[i];
}
return temp;
}
Arrays is a class in the java.util package that has a lot of useful methods for sorting, searching, filling, copying, printing arrays of any primitive or object type.
Bookmarks