it's been some time since I last coded in Java, but I need a little hint here. We have a simple function - note that this is C:
void update(double *source, double *target, int n) {
for(int i = 0; i < n; ++i)
target[i] = source[i] * i; // well, actually a bit more complicated, just some kind of calculation
}
So, now I need to recode this function in Java - efficiently. My problems are:
- Java has of course no pointers, so how can I pass the arrays efficiently without having large amounts of memory copy operations due to call by value
- Which data structure is the best to store the arrays
Note that source and target are large arrays, storing up to 1 million elements