for(int[] row : array){
for (int cell:row){
int index = Arrays.asList(array).indexOf(cell);
You get a little confused between your rows and cells. arrayis an array of arrays, so it indexOf()will look for the values of the array (string), but the value cellyou pass is simple int. He can never find an intequal int[].
for-each, , . for for-each.
for(int rowIndex = 0; rowIndex < array.length; rowIndex++) {
int[] row = array[rowIndex];
for(int columnIndex = 0; columnIndex < row.length; columnIndex++) {
int[] surroundingCells = getSurroundingCells(rowIndex, columnIndex);
, , , Java , . , :
int cell = array[rowIndex][columnIndex];
cell = someValue;
array[rowIndex][columnIndex] = someValue;