Tag Archives: Math

Bits Manipulation in Java

1. Detect if two integers have opposite signs. 2. Determining if an integer is a power of 2. 3. Swap the values of a and b without using a temporary variable. 4. Check non-zero. References: Gayle Laakmann Mcdowell, “Bit Manipulation”, in Cracking the code interview, 6th Edition. Bit Twiddling Hacks, Accessed at https://graphics.stanford.edu/~seander/bithacks.html Bit Manipulation… Read More »