since it is -1 something like this
since i is int it is 32 bit(4 byte)
10000000 00000000 00000000 00000001
this last line is incorrect. to get the binary representation of a number, follow these steps:
write the positive number in binary. so for -1, we'd write 1 in binary:
00000000 00000000 00000000 00000001
now, flip every bit to it's alternate state:
11111111 11111111 11111111 11111110
Last, add 1:
11111111 11111111 11111111 11111111
now that we have -1 in binary, we can do the bit shift. move everything over one bit, keep the sign bit, and we get:
11111111 11111111 11111111 11111111
which is -1.
[ May 25, 2005: Message edited by: fred rosenberger ]