Can anyone tell me how i convert a String filled with a hexadecimal
number to an integer? I'm sure there is a standard function for that
but I cant find it. Help!
Email answer plz to e...@sci.kun.nl
Greetx, Erik
int iDecimalValue = Integer.parseInt( "3E8", 16 );
To go the other way, you can do this:
String hex = Integer.toHexString( 1000 );
'drew
For this and the 255 other similar conversion questions, see "conversion"
in the Java glossary. There a table showing you how to convert anything to
anything including your hex String to int.. There is also a program called
the Java Amanuensis that will generate code for you that you can cut/paste.
For the JAVA GLOSSARY and the CMP Utilities: <http://oberon.ark.com/~roedy>
--
Roedy Green Canadian Mind Products
Sponsored by: www.athena.com, makers of Integer, a multiuser
spreadsheet JavaBean. Opinions expressed are not necessarily
those of Athena Design.
-30-
- good luck
Erik Hietbrink wrote in message <6jeb1h$dfq$1...@studs3.sci.kun.nl>...
>Hi
>
>Can anyone tell me how i convert a String filled with a hexadecimal
>number to an integer? I'm sure there is a standard function for that
>but I cant find it. Help!
>
Yes, there *IS* a standard way to convert a Hexidecimal string and nothing
in the question had anything to do with the Double class. Sheesh.
Try:
int intValue = Integer.parseInt(hexString, 16);
There are many more functions for such conversions described in the
JDK-1.1.6 online documentation under "java.lang.Integer".
Rick Miller
http://www.execpc.com/~rdmiller/
Thomas B. Hoeft wrote in message <6jfti6$7rp$1...@news.cybernex.net>...