This week's book giveaway is in the Servlets forum. We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line! See this thread for details.

Negative numbers in bitwise arithmetic are confusing. You have to work out what the negative numbers look like in binary (two's complement representation). Then the bitwise operation will make sense.

When writing code, I would suggest that you never use negative integer literals (e.g. -2) in a bitwise expression. The clearest representation is usually hexadecimal literals (e.g. 0xFFFFFFFE), because that is very easily translatable to binary in the head of the person reading your code.

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.

The formula is to always convert the number to binary 0's and 1's, perform the operation, then convert it back. For exams or homework problems, you're not likely to find a better way to do it by hand.