I imagine this code is intended to
test your understanding of signed 2's-complement behavior as well as operator precedence.
Which comes first the unsigned shift operator or the bitwise operator? It's not too baffling, really -- just find the table. Or, just demonstrate it to yourself:
The
real test of this code, in my opinion, is to see how quickly you'll think to write your own demonstration.
Elsewhere in another forum a poster was commenting that it seemed silly to test an
SCJP with a technical interview. I couldn't disagree more. If I have learned
anything from this site, it is that some people are astoundingly good test takers. What I want to know when I hire someone, however, is not whether they're proficient in the elements of the language but how they work. I'd sooner hire someone who can show their work than someone who can rattle everything off from memory.
Do the work! It seems soooo slow to do things this way but you'll get faster. Write code any time you have a doubt; you'll learn far more.