Easy Java 
Give each island different name and calculate the area of each island.\n2. Try each point grid[i][j] == 0 to see which island this point connects to. \n\n\n    
1. Give each island different name and calculate the area of each island.\n2. Try each point grid[i][j] == 0 to see which island this point connects to. \n\n```\n    Set<String> set = new HashSet<>();\n    int res = 0;\n    public int largestIsland(int[][] grid) {\n        Map<String,String> map = new HashMap<>();\n        int m = grid.length, index = 0;\n        boolean[][] visited = new boolean[m][m];\n        for (int i = 0; i < m; i++) {\n            for (int j = 0; j < m; j++) {\n                if (grid[i][j] == 1 && !visited[i][j]) {\n                    helper(grid,visited,i,j);\n                    for (String s : set) map.put(s,res + "+" + index);\n                    res = 0;\n                    set.clear();\n                    index++;\n                } \n            }\n        }\n        int max = 0;\n        int[][] neibor = new int[][]{{-1,0},{1,0},{0,-1},{0,1}};\n        for (int i = 0; i < m; i++) {\n            for (int j = 0; j < m; j++) {\n                if (grid[i][j] == 0) {\n                    int tempvalue = 1;\n                    set.clear();\n                    for (int k = 0; k < 4; k++) {\n                        int row = i + neibor[k][0];\n                        int col = j + neibor[k][1];\n                        if (row >=0 && row < m && col >= 0 && col < m && grid[row][col] == 1) {\n                            String temp = row + "+" + col;\n                            String value = map.get(temp);\n                            String[] strs = value.split("\\\\+");\n                            if (set.add(strs[1])) tempvalue += Integer.parseInt(strs[0]); \n                        }\n                    }\n                    max = Math.max(max,tempvalue);\n                }\n            }\n        }\n        return max == 0 ? m*m : max;\n    }\n    \n    public void helper(int[][] grid, boolean[][] visited, int temprow, int tempcol) {\n        visited[temprow][tempcol] = true;\n        int m = grid.length;\n        set.add(temprow + "+" + tempcol);\n        res++;\n        int[][] neibor = new int[][]{{-1,0},{1,0},{0,-1},{0,1}};\n        for (int i = 0; i < 4; i++) {\n            int row = temprow + neibor[i][0];\n            int col = tempcol + neibor[i][1];\n            if (row >=0 && row < m && col >= 0 && col < m && grid[row][col] == 1 && !visited[row][col]) helper(grid, visited, row, col);\n        }\n    }\n```
[]