Easy Java StringBuilder Solution
class Solution {\n    public int findComplement(int num) {\n        String s=Integer.toBinaryString(num);\n        StringBuilder sb=new StringBuilder();\n      
class Solution {\n    public int findComplement(int num) {\n        String s=Integer.toBinaryString(num);\n        StringBuilder sb=new StringBuilder();\n        for(int i=0;i<s.length();i++){\n            if(s.charAt(i)==\'1\'){\n                sb.append(\'0\');\n            }\n            else{\n                sb.append(\'1\');\n            }\n        }\n        return (Integer.parseInt(sb.toString(),2));\n    }\n}
[]