posted 15 years ago
Hi srinibash udayasingh ,
If the left-hand operand is positive, the result is the same as a right-hift
For example: 16 >> 2 = 4
Decimal 16 00000000000000000000000000010000
Right-shift 2 00000000000000000000000000010000
fill left 00000000000000000000000000000100
discard right 00000000000000000000000000000100 -> Decimal 4
If the left-hand operand is negative,
For example: -16 >>> 2 = 1,073,741,820
Decimal -16 11111111111111111111111111110000
>>> 2 11111111111111111111111111110000
fill left 0011111111111111111111111111110000
discard right 00111111111111111111111111111100 -> 1,073,741,820.
Hope it will help you.
Thanks & Regards<br />Mallik Avula<br />SCJP1.4