To find complement of `num = 5`

which is `101`

in binary.

First `~num`

gives `...11111010`

but we only care about the rightmost 3 bits.

Then to erase the `1`

s before `010`

we can add `1000`

```
public int findComplement(int num) {
return ~num + (Integer.highestOneBit(num) << 1);
}
```