Java | For Loops | Easy Implementation
\nclass Solution {\n    public int[][] largestLocal(int[][] grid) {\n        int n = grid.length;\n        int arr[][] = new int[n-2][n-2];\n        for(int i=0
```\nclass Solution {\n    public int[][] largestLocal(int[][] grid) {\n        int n = grid.length;\n        int arr[][] = 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                arr[i][j]=local(grid,i,j);\n            }\n        }\n        return arr;\n    }\n    public int local(int g[][],int x,int y){\n        int max = Integer.MIN_VALUE;\n        for(int i=x;i<x+3;i++){\n            for(int j=y;j<y+3;j++){\n                if(g[i][j]>max)\n                    max=g[i][j];\n            }\n        }\n        return max;\n    }\n}\n```\nKindly upvote if you like the code.
['Array', 'Matrix', 'Java']