How does bitwise (~) operator work

Ans: It converts all the 1 bits in a binary value to 0s and all the 0 bits to 1s, e.g

11110000 coverts to 00001111