The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Conversion 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 "Conversion" Watch "Conversion" New topic


Javix Protocol
Ranch Hand

Joined: Mar 21, 2000
Posts: 57
How to convert a decimal integer literal to octal and hexadecimal literal?

Write Once , Run Anytime ,Anywhere Forever And Smile Happily.
Jesper Ottosson
Ranch Hand

Joined: Mar 21, 2000
Posts: 51
the decimal number 20 is:
0x14 in hex
024 in oct
so just prefix with 0x when you want hexadecimal and 0 when you want octal
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Conversion
Similar Threads
Did you hear the one ... ?
(heavy breathing goes here)
Is "null" a keyword in Java?
The .class property