Fully explained Java solution
\n# Code\n\nclass Solution {\n    public int findMaxFish(int[][] grid) {\n        int max=0;\n\t\t// Loop over the Entire Grid\n        for(int i=0;i< grid.leng
\n# Code\n```\nclass Solution {\n    public int findMaxFish(int[][] grid) {\n        int max=0;\n\t\t// Loop over the Entire Grid\n        for(int i=0;i< grid.length; i++){\n            for(int j=0; j<grid[0].length; j++){\n\t\t\t    // only call the dfs call when we encounter a value>0, then find the number of connected land and calculate value and compare it with the previous max\n                if(grid[i][j]>0){\n                    max= Math.max(max, dfs(grid, i, j));\n                }\n            }\n        }\n        return max;\n    }\n    \n    public int dfs(int[][] grid, int i, int j){\n\t\t// if we gets out of bound or its a 0 i.e. water then return 0\n        if(i<0 || i>=grid.length || j<0 || j>=grid[0].length || grid[i][j]==0) return 0;\n\t\t// if not then mark the grid value to 0 to make sure we do not come back to the same piece of land and cause infinite recursion i.e. stack over flow\n        int val = grid[i][j];\n        grid[i][j]=0;\n\t\t// now just go to all 4 direction get the respective counts and add it all together and return it\n        return val+ dfs(grid, i-1, j)+ dfs(grid, i+1, j)+ dfs(grid, i, j-1)+ dfs(grid, i, j+1);\n    }\n    \n    \n}\n```
['Depth-First Search', 'Graph', 'Java']