You need to make a funnel of red numbers.
That's what I have now
public class Matrix { public static void main(String[] args) { // TODO Auto-generated method stub int [][] twoDim = { { 1,2,3,4,5 }, { 5,4,3,2,1 }, { 6,7,8,9,1 }, { 2,4,3,1,3 }, { 5,4,3,2,1 }, }; int max = twoDim[0][0]; for(int i = 0; i < twoDim.length; i++) { // 1 2 3 4 5 for(int j = 0; j <twoDim[i].length; j++) { // 1 2 3 4 5 if(twoDim[i][j]>max) { max = twoDim[i][j]; } } // end of for J // System.out.println(); } // end of for i System.out.println(max); } }
I just found the maximum from the array, but I can’t understand how to make a funnel automated so that the index decreases by 1 on both sides