Hi, I have to write code that takes a 2d array, overlays a 128 grid over it and takes the value of the 2d array at the grid location and assigns it to a new 2d array. This is the results I want but I can't get the for loops to do this. array1 [2][2] = array2 [0][0] array1 [2][4] = array2 [0][1]
my code so far is as follows:
int x = (int)Math.rint((float)width/(float)128);
array2 = newint [128][128];
for (int i = x; i < 128; i= i+x) {
for (int j = x; j < 128; j=j+x) {
for(int a=0; a < 128;a++){
for (int b=0;b<128;b++){
array1[a][b]=array2[i][j];
}
}
}
}
}
array1 = array2;
}