@@ -0,0 +1,924 @@
+import java.io.*;%0Aimport java.util.*;%0Aimport java.text.*;%0Aimport java.math.*;%0Aimport java.util.regex.*;%0A%0Apublic class Solution %7B%0A%0A  public static void main(String%5B%5D args) %7B%0A%0A    Scanner sc = new Scanner(System.in);%0A    int%5B%5D%5B%5D matrix = new int%5B6%5D%5B6%5D; // hardcoded dimensions%0A%0A    for (int i = 0; i %3C 6; i++)%7B // hardcoded%0A      for (int j = 0; j %3C 6; j++)%7B //hardcoded%0A        matrix%5Bi%5D%5Bj%5D = sc.nextInt();%0A      %7D%0A    %7D%0A%0A    int max = -64; // (-9 * 7) -1%0A%0A    for (int i = 1; i %3C 5; i++)%7B%0A      for (int j = 1; j %3C 5; j++)%7B%0A        int curr = matrix%5Bi%5D%5Bj%5D     +%0A                   matrix%5Bi-1%5D%5Bj-1%5D +%0A                   matrix%5Bi-1%5D%5Bj%5D   +%0A                   matrix%5Bi-1%5D%5Bj+1%5D +%0A                   matrix%5Bi+1%5D%5Bj-1%5D +%0A                   matrix%5Bi+1%5D%5Bj%5D   +%0A                   matrix%5Bi+1%5D%5Bj+1%5D;%0A        if (curr %3E max) %7B max = curr; %7D%0A      %7D%0A    %7D // fix up hardcoded hourglass shape indexes%0A%0A    System.out.println(max);%0A%0A  %7D%0A%7D%0A

Solve java 2d array