Ref. Wiki
Bitwise operations are contrasted by byte-level operations which characterize the bitwise operators’ logical counterparts, the AND, OR and NOT operators. Instead of performing on individual bits, these operators perform on strings of eight bits (known as bytes) at a time. The reason for this is that a byte is normally the smallest unit of addressable memory (i.e. data with a unique memory address.)
- AND
- OR
- XOR
- ~
Ex. In Java
0 AND 0 : 0 & 0 => 0
0 AND 1 : 0 & 1 => 0
1 AND 0 : 1 & 0 => 0
1 AND 1 : 1 & 1 => 1
0 OR 0 : 0 | 0 => 0
0 OR 1 : 0 | 1 => 1
1 OR 0 : 1 | 0 => 1
1 OR 1 : 1 | 1 => 1
0 XOR 0 : 0 ^ 0 => 0
0 XOR 1 : 0 ^ 1 => 1
1 XOR 0 : 1 ^ 0 => 1
1 XOR 1 : 1 ^ 1 => 0
the complement of 0 : ~0 => -1
the complement of 1 : ~1 => -2
the complement of 2 : ~2 => -3
the complement of 3 : ~3 => -4