Originally posted by gayathri mukkavilli:
Does it mean the result of int shift is always between 0 and 31 and the result of long shift is always between 0 and 63? ...
It's the
amount of the shift -- not the result of the operation -- that's within these bounds.
For example, consider 100>>35. Here the right operand is 35. But since these are ints, only the last five bits of the 35 will be used, so instead of binary 100011, we have binary 11, which is 3. So 100>>35 is equivalent to 100>>3.