How Bitwise Logic Works
Bitwise operators compare two numbers one bit column at a time, using the same simple rule for every column. AND needs both bits to be 1, OR needs at least one, XOR needs exactly one, and NOT simply flips a single bit.
For AND, when is the output 1?