M
M
Hi,
I was told that an Java int is a signed 32 bits integer and
ranged from -2^31 to 2^31 -1 (^: to the power of).
Then, I would like to know if -31 should be represented by:
(1) 10000000 00000000 00000000 00011111, or
(2) 11111111 11111111 11111111 11111111
(1) or (2)?
I think it's (2) because -31 >>> 5 yields 3
but I found no doc from java.sun.com relating to this.
Please let me have your comments or please
direct me to some websites for clarifications.
Thx
I was told that an Java int is a signed 32 bits integer and
ranged from -2^31 to 2^31 -1 (^: to the power of).
Then, I would like to know if -31 should be represented by:
(1) 10000000 00000000 00000000 00011111, or
(2) 11111111 11111111 11111111 11111111
(1) or (2)?
I think it's (2) because -31 >>> 5 yields 3
but I found no doc from java.sun.com relating to this.
Please let me have your comments or please
direct me to some websites for clarifications.
Thx