Java | Beginner Friendly | Runtime: 1ms
\nclass Solution {\n    public int findComplement(int num) {\n\t\tString binary = Integer.toBinaryString(num);\n\t\tString complement = "";\n\t\tfor(int i = 0; 
```\nclass Solution {\n    public int findComplement(int num) {\n\t\tString binary = Integer.toBinaryString(num);\n\t\tString complement = "";\n\t\tfor(int i = 0; i < binary.length(); i++) {\n\t\t\tif(binary.charAt(i) == \'1\') {\n\t\t\t\tcomplement += \'0\';\n\t\t\t}\n\t\t\telse if(binary.charAt(i) == \'0\') {\n\t\t\t\tcomplement += \'1\';\n\t\t\t}\n\t\t}\n\t\tint decimal = Integer.parseInt(complement, 2); \n\t\treturn decimal;  \n    }\n}\n```
['Java']