Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

problem of negative sign in conversion of hexadecimal to decimal.

843785Jul 24 2008 — edited Jul 25 2008
class D {
public static void main (String args[]) {
int i= 0x80000000;
int j=0x7FFFFFFF;
System.out.print(i+" , "+j);
}}

The value of 'i' = 8*(16^7) =2^31 i.e. 2 raised to power 31.
But it prints -2^31= -2147483648. My problem is that how we are getting a negative sign in 'i' ?
while On printing 'j' we get a positive value.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 22 2008
Added on Jul 24 2008
2 comments
281 views