hi , i am preparing for scjp exam, i am very much confused with the shift operators, one of my questions is how to arrive at the binary representation of an negative number. and example of >>> shift of negative numbers, i have searched through the javaranch for shift operators, even though i found some good examples, but still am not clear about the concept, i appreciate any help. thanks in advance.
As Janilu says, search this forum - there's more information on bit operations and bit shifts and two's complement than you can shake a stick at, ya li'l doggie! Here's a quick answer: To get a negative version of a number, take the positive version, flip the bits, and add 1.
The >>> operator (unsigned right shift) shifts all bits to the right and fills the left with 0's. Corey