programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Jeanne Boyarsky
• Ron McLeod
• Paul Clapham
• Liutauras Vilda
Sheriffs:
• paul wheaton
• Rob Spoor
• Devaka Cooray
Saloon Keepers:
• Stephan van Hulst
• Tim Holloway
• Carey Brown
• Frits Walraven
• Tim Moores
Bartenders:
• Mikalai Zaikin

# How to convert hexadecimal to decimal /integer ?

Ranch Hand
Posts: 34
• Number of slices to send:
Optional 'thank-you' note:
Hi...
my question is too basic...
but i am confused...
just tell me
How to convert hexadecimal to decimal /integer ?
means ...
oX7fffffff = 2147483647
how can i calculate this ?

this topic is from first chapter of kathy's book ...
[ January 04, 2007: Message edited by: Kavita Kale ]

Ranch Hand
Posts: 10198
3
• Number of slices to send:
Optional 'thank-you' note:
If you have Khalid Mughals book for 1.4, you have a dedicated topic as an Appendix. You can easily google out your querry and you'll find numerous links explaining this.

Ranch Hand
Posts: 381
• Number of slices to send:
Optional 'thank-you' note:
Make a Integer object like
Integer ii = new Integer(oX7fffffff);
//get the int value.
System.out.prinltn(ii.intValue());

Ranch Hand
Posts: 152
• Number of slices to send:
Optional 'thank-you' note:
Actually is not necessary to use a wrapper class like Integer.

You can just use:

int a = 0xA;

System.out.println(a);

-----------------------------

The most important thing to remember maybe is you are not converting the data. You are just seeing it from a different point of view.

Internally the PC sees your data as binary. But it is still the same.

Ranch Hand
Posts: 66
• Number of slices to send:
Optional 'thank-you' note:
Hi,

It basically works like binary, except the base is 16.

For example:
b*16^2 + a*16^1 + d*16^0
= 11*256 + 10*16 + 13*1
= 2816 + 160 + 13
= 2989

Kavita Kale
Ranch Hand
Posts: 34
• Number of slices to send:
Optional 'thank-you' note:
Thank you Tommaso...
now i am feeling i am perfect in this topic.

lowercase baba
Posts: 13091
67
• Number of slices to send:
Optional 'thank-you' note:

It basically works like binary, except the base is 16.

True - but don't forget about the sign bit...

author
Posts: 9050
21
• Number of slices to send:
Optional 'thank-you' note:
And remember, this is only important for the 1.4 exam - it's NOT on the 5.0 exam

fred rosenberger
lowercase baba
Posts: 13091
67
• Number of slices to send:
Optional 'thank-you' note:

Originally posted by Bert Bates:
And remember, this is only important for the 1.4 exam - it's NOT on the 5.0 exam

You took this off the 1.5 exam??? ppffff!!! These kids today don't have to learn ANYTHING, do they?

 expectation is the root of all heartache - shakespeare. tiny ad: a bit of art, as a gift, the permaculture playing cards https://gardener-gift.com