You want to be using the right shift operators (there are two) and shift thevalue right:
if ((input >>> 24) == 0) {
// high-order 40 bits are all 0.
}
Alternatively, you can simply bit-mask with:
if ((input & 0xFFFFFFFFFF000000L) == 0) {
// high-order 40 bits are all 0.
}
Note that >>>
will put 0 in the high-order bits, and >>
will put 0 for positive numbers, and 1 for negative.