|
|
|
1000 Java Tips ebook
|
|
 

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java
programming articles and tips. Please take your copy here.
Take your copy of free "Java Technology Screensaver"!. |
|
How can I in Java convert this string 23AB to its hexadecimal representation 323
|
JavaFAQ Home » General Java

Question: How can in Java I convert this string
23AB to its hexadecimal representation 32334142.
Is there any method that can do that easily?
Or how could I write this function?
Answer: It is easy indeed:
Use parsing functions form Java API's class Integer...
Integer.parseInt(String s, int radix)
(for hexadecimal radix=16)
and
Integer.toHexString(int i).
It is good idea to add NumberFormatException handling Printer Friendly Page
Send to a Friend
..
Search here again if you need more info!
|
|
|