Bitwise operations

Bitwise operations act upon individual bits within integer data.
They are used to perform the logical operations AND, OR, and XOR (eXclusive OR), complementing (reversing all bits), and shifting (sliding bits to the left or right).
Logical bitwise operations
1. Use the standard boolean operators (&, |, and ^) to act upon two integer values. The     short-circuit boolean operators (&& and ||) are not used for bitwise operations and will     result in a compile error if attempted.
2. Produce an integer result (of size int or larger) that is the logical AND, OR, or XOR of two     operands.
The rules for these operations are as follows:
Operation
Rule
& If both corresponding operand bits are “on” the result bit is “on”
| If either corresponding operand bit is “on” the result bit is “on”
^ If corresponding operand bits are different the result bit is “on”