T
talk
hi, guy
a program as listed below:
" short number = -32768;
System.out.println((short)(number >>> 1));"
i wonder why the output is -16384, not 16384?
the bit sequences of -32768 is 1000,0000,0000,0000;
so (number >>> 1) should be 0100,0000,0000,0000, it is 16384.
but why the output is 1100,0000,0000,0000, it is -16384.
a program as listed below:
" short number = -32768;
System.out.println((short)(number >>> 1));"
i wonder why the output is -16384, not 16384?
the bit sequences of -32768 is 1000,0000,0000,0000;
so (number >>> 1) should be 0100,0000,0000,0000, it is 16384.
but why the output is 1100,0000,0000,0000, it is -16384.