Bitwise NOT (~) Operator and Two’s Complement in Java

The ~ operator, also known as the bitwise NOT operator, inverts each bit of a number.