I want to invert the bits in binary string. For example String 000 should be inverted as 111 and 1101 as 0010. Can anybody help on this?
s = s.replace('0', '2').replace('1', '0').replace('2', '1');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With