Originally posted by xusoo:
Question:
byte bval=0x70;
bval=(byte)(bval>>9);
-----
Why the result is 0x00,not 0x38?
Thanks.
xusoo
I believe you are expecting 9%8 as the value of the right operand in this equation.
Integral types byte,short,& char are all promoted to int before any operations are performed (that is why you put an explicit cast to byte there). So the maximum value of the right operand in a shift operations is the same as int, i.e. 31.
Hope this helps.
[ August 25, 2003: Message edited by: Alton Hernandez ]