java – Converting hex to character code


I have a variable of type String , which contains the following value: "0xF9" .
How do I get the output character whose code is the hex value in this line?


Option using Integer.decode method:

String str = "0xF9";
int code = Integer.decode(str);
char c = (char)code;

And the output to the screen in one line within the framework, relatively speaking, code golf:

Scroll to Top