This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Hexadecimal Numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Hexadecimal Numbers" Watch "Hexadecimal Numbers" New topic
Author

Hexadecimal Numbers

Sunita Vontel
Ranch Hand

Joined: Aug 28, 2000
Posts: 72
How do I convert a Decimal number to hexadecimal notation??
Herbert Maosa
Ranch Hand

Joined: May 03, 2000
Posts: 289
You basically divide the number successively by 16 until you get a remainder that is less than 16.
That is, for the number 20 for example:
20/16 you have 1 rem 4.
So your number 20 in hex will be 14, and in hava hex notation that will be 0x14.
for the number 40 you have:
40/16 2 rem 8
and becomes 0x28
I hope this helps.
Sunita Vontel
Ranch Hand

Joined: Aug 28, 2000
Posts: 72
Thanks herbert.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Hexadecimal Numbers
 
Similar Threads
Another Ques from abhilash's site
shifting
fundamentals
Hexadecimal
Java Object Reference Variable Question