The best solution for beginners
\n\n"a" and "b" denotes row and column respectively do not confuse, as a beginner.\n\n\nINSTEAD OF WRITING "a < i+3" you can also write "a <= i+2" ;\n\nDo work 
\n\n**"a"** and **"b"** denotes **row** and **column** respectively do not confuse, as a beginner.\n\n\nINSTEAD OF WRITING **"a < i+3"** you can also write **"a <= i+2"** ;\n\n**Do work on your fundamentals, Try to read and understand the code.**\n\nTry to put your 1% efforts daily.\n\n# Code\n```\nclass Solution {\n    public int[][] largestLocal(int[][] grid) {\n        int n = grid.length;\n        int res[][] = new int[n-2][n-2];\n        for (int i = 0; i < n-2; i++) {\n            for (int j = 0; j < n-2; j++) {\n                res[i][j] = findMax(grid, i, j);\n            }\n        }\n        return res;\n    }\n    public int findMax(int[][] grid, int i, int j) {\n        int max = Integer.MIN_VALUE;\n        for (int a = i; a < i+3; a++) {\n            for (int b = j; b < j+3; b++) {\n                max = Math.max(grid[a][b], max);\n            }\n        }\n        return max;\n    }\n\n}\n```
['Java']