Hey, everyone. My goal here is to be able to load a 3x4000*4000 multidimensional array, modify it, save it, and QUICKLY access it (as if accessing a 100x100 array). I'm not really sure how this works in the JVM but...I mean I'm at a loss.
Would making a single int[] array of 48,000,000 be more effective (though less human friendly)?
I would like to be able to iterate through a section of about 100x100 for now.
What I have now is this:
private int[][] get100x100array(){
int[][] array = new int[100][100];
for(int i = 0; i < blocks.length; i++){
int[] row = new int[100];
System.arraycopy(my3x4000x4000array[i + offset], 3000 /*theoretical starting position*/, row, 0, 100);
array[i] = row;
}
return array;
}
But this turns out to be to slow to repeatedly iterate. Optimizations that I cannot see are probably needed. I have no idea what to do.
P.S. The array that will be most iterated over will be my3x4000x4000array[0]. If I should single that out to be by itself and that will help the speed, tell me. The 3x4000x4000 is rounded out for the possibility of putting it into a single array.