Thursday, June 3, 2010

Ghost of Looper

A small java puzzle tests your knowledge in Bit-wise operations

Provide a declaration for i that turns this loop into an infinite loop:

while (i != 0)

i >>>= 1;


Recall that >>>= is the assignment operator corresponding to the unsigned right-shift operator. Zeros are shifted in from the left to fill bits vacated by the shift, even if the value being shifted is negative.

Solution will be posted Soon ……….






 

No comments:

Post a Comment