Shifting Operator

hi

i want to shift a byte to the right by 6 (unsigned)

the shift operator returns an integer so the value returned is inconsistent

for example:

if the byte is -27 ( 11100101 ) and i shifted it by six

tempByte = -27;

tempByte = tempByte >>> 6;

and i cast the value returned to bytethe value becomes -1 ?

if want to get 3

so how can i do this?

thanks in advance

[438 byte] By [el3oriana] at [2007-11-27 3:05:24]
# 1
byte b = -27;System.out.println(((b & 0xff) >>> 6));Kaj
kajbja at 2007-7-12 3:50:54 > top of Java-index,Java Essentials,Java Programming...