[Java] Easy 100% BFS solution
java\n/**\n * Definition for a binary tree node.\n * public class TreeNode {\n *     int val;\n *     TreeNode left;\n *     TreeNode right;\n *     TreeNode() 
```java\n/**\n * Definition for a binary tree node.\n * public class TreeNode {\n *     int val;\n *     TreeNode left;\n *     TreeNode right;\n *     TreeNode() {}\n *     TreeNode(int val) { this.val = val; }\n *     TreeNode(int val, TreeNode left, TreeNode right) {\n *         this.val = val;\n *         this.left = left;\n *         this.right = right;\n *     }\n * }\n */\nclass Solution {\n    public int maxLevelSum(TreeNode root) {\n        int result = 1, level = 1, max = root.val;\n        Queue<TreeNode> queue = new LinkedList<>();\n\n        queue.offer(root);\n\n        while(!queue.isEmpty()) {\n            int size = queue.size(), sum = 0;\n\n            for(int i = 0; i < size; ++i) {\n                TreeNode node = queue.poll();\n                sum += node.val;\n\n                if(node.left != null)\n                    queue.offer(node.left);\n                if(node.right != null)\n                    queue.offer(node.right);\n            }\n\n            if(max < sum) {\n                max = sum;\n                result = level;\n            }\n\n            ++level;\n        }\n\n        return result;\n    }\n}\n```
['Java']