A) long a = l >> 33;
B) int b = lL >> 33;
C) long c = l >> 33;
X = Y
shift operation Z
Per the JLS,
Java looks at the data of the left side of the operation, the Y. If it is a data type smaller than an int, it is cast to an int. Then, if it is an int as it is in A and C above, the right side of the operation is & (anded) with 0x1F or 31. If the left side of the shift operation is a long, the right side is & with 0x3F or 63.
So, A and C the left side of the shift is an int, the right side is & with 31
33 = 00000000 00000000 00000000 00100001
31 = 00000000 00000000 00000000 00011111
Which equals 1
In B the left side of the shift is a long so the right side is & with 63
63 = 00000000 00000000 00000000 00111111
Which remains 33
In all cases, the shift results in moving the only bit set off and leaving 0.
------------------
Hope This Helps:)
Carl Trusiak