As you have a 2-d array, you have two length values for each loop:
//you have this? array[][];
for(int i = 0; i < array.length; ++i) {
for(int j = 0; j < array[i].length; ++j) {
//do something on array[i][j]
}
}
solved Using two for loops to loop through a 2D array in java