String in hexadecimal value

Is there any java utility to convert a string to a hexadecimal value (integer)?

+5
source share
4 answers

If you have a line starting with 0x or #

Integer.decode(hexStr);

is the goal

Or

Integer.parseInt(hexString, 16);
+14
source

Is this what you are looking for?

Integer.toHexString(Integer.parseInt(String));
+4
source

, .

(, "ab10" ),

int i = Integer.valueOf(s, 16).intValue();
+3

Integer class:

Integer.toHexString(Integer.parseInt(myString, 10))

, .

+1

All Articles