This week's book giveaway is in the Agile forum. We're giving away four copies of The Software Craftsman and have Sandro Mancuso on-line! See this thread for details.

Hi folks, can someone explain why int i = -1; System.out.println(i >>> 32); prints -1 and not 0 as I expected. So ((i >>> 31) >>> 1) is not equal to (i >>> 32)? greetings Juergen.

This is one of the most confusing and counter-intuitive things people seem to encounter when first learning Java. If i is an integer, the compiler treats i>>>j as i>>>(j % 32), so i>>>32 is equivalent to i>>>0 which is equivalent to just plain i. The same rule is true for >> and << . The only explanation I've seen is that this optimizes the use of certain CPUs.