• + 0 comments
        int sum[][] = new int[4][4];
    
        for(int x=0; x<4; ++x){
            for(int y=0; y<4; ++y) {
                sum[x][y] = arr.get(x).get(y)+arr.get(x).get(y+1)+arr.get(x).get(y+2)+
                        arr.get(x+1).get(y+1)+
                        arr.get(x+2).get(y)+arr.get(x+2).get(y+1)+arr.get(x+2).get(y+2);
            }
        }
    
        int num = 0;
        int max = sum[0][0];
    
        for(int x=0; x<4; ++x) {
            for (int y = 0; y < 4; ++y) {
                num = sum[x][y];
                if (num > max) {
                    max = num;
                }
            }
        }
    
        System.out.print(max);