```
public int findComplement(int num) {
String s = Integer.toBinaryString(num);
int result =0,j=s.length()-1;
for(int i=0;i<s.length();i++){
if(s.charAt(i)=='0') result+=Math.pow(2,j);
j--;
}
return result;
}
}
```