Simple Soluion
\n\n# Code\n\nclass Solution {\n    public int bitwiseComplement(int n) {\n        String bin = Integer.toBinaryString(n);\n        String res = "";\n        fo
\n\n# Code\n```\nclass Solution {\n    public int bitwiseComplement(int n) {\n        String bin = Integer.toBinaryString(n);\n        String res = "";\n        for(char c :bin.toCharArray())\n        {\n            if( c == \'1\')\n                res += "0";\n            else\n                res += "1";\n        }\n        return Integer.parseInt(res, 2);\n    }\n}\n```
['Java']