Timeline of everything I publish. Prefer a topic? Browse by technology in the menu.
Bitwise Operators in Java: What They Are, Where They Came From, and When to Use Them
In short: use bitwise operators in Java when the problem is genuinely binary. That means compact permissions and flags (hand-written bit masks, as in hardware registers; in everyday application code, prefer EnumSet, which stores the flags as bits for you, without any bitwise operators in your code), binary protocols and formats (parsing headers, RGB/ARGB colors with <<, >> and &), hashes and checksums (hashCode(), CRC, MurmurHash), and low-level algorithms where the bit operation is the algorithm (counting bits, detecting a power of two with (n & (n - 1)) == 0, or swapping without a temporary variable in specific embedded-systems contexts). ...