@@ -0,0 +1,1090 @@
+package leetcode.count_complete_tree_nodes;%0A%0Aimport common.TreeNode;%0A%0Apublic class Solution %7B%0A    public int countNodes(TreeNode root) %7B%0A        if(root == null) return 0;%0A        int h = 0;%0A        TreeNode left = root.left;%0A        while(left != null)%7B%0A            left = left.left;%0A            h++;%0A        %7D%0A        int L = 0, U = 1 %3C%3C h;%0A        while(L + 1 %3C U)%7B%0A            int mid = L + (U - L) / 2;%0A            TreeNode now = root;%0A            for(int i = h - 1; i %3E= 0; i--)%7B%0A                if(((1 %3C%3C i) & mid) != 0)%7B%0A                    now = now.right;%0A                %7Delse%7B%0A                    now = now.left;%0A                %7D%0A            %7D%0A            if(now == null)%7B%0A                U = mid;%0A            %7Delse%7B%0A                L = mid;%0A            %7D%0A        %7D%0A        return L + (1 %3C%3C h);%0A    %7D%0A    %0A    public static void main(String%5B%5D args)%7B%0A        TreeNode root = new TreeNode(0);%0A        root.left = new TreeNode(1);%0A        root.right = new TreeNode(1);%0A        root.left.left = new TreeNode(1);%0A        System.err.println(new Solution().countNodes(root));%0A    %7D%0A%7D%0A

Add java solution for 222. Count Complete Tree Nodes