# Shift Operators

niting Grover

Greenhorn

Posts: 1

Mike Gershman

Ranch Hand

Posts: 1272

posted 12 years ago

-128 in decimal is 11111111 11111111 11111111 10000000 in binary

a >> 1 shifts the bits of a one place to the right, filling the gap on the left with a copy of the original leftmost (sign) bit, giving us

-64 in decimal which is 11111111 11111111 11111111 11000000 in binary

a >> 1 shifts the bits of a one place to the right, filling the gap on the left with a copy of the original leftmost (sign) bit, giving us

-64 in decimal which is 11111111 11111111 11111111 11000000 in binary

Mike Gershman

SCJP 1.4, SCWCD in process