This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
In addition to the other good feedback you've gotten here, remember that bit manipulations like this one are a part of the 1.4 exam, but if you're studying for the 5.0 exam (which I'd recommend), you don't need to study any form of bit manipulation.
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)