You have not converted ASCII to hexadecimal. You had char values ββin hexadecimal, and you wanted to convert it to String , as I interpret your question.
String s = new String(new char[] { 0x31, 0x32, 0x2E, 0x30, 0x31, 0x33 }); System.out.println(s);
If you specify a string, and you want to print it char as a hex, here's how to do it:
for (char ch : "12.013".toCharArray()) { System.out.print(Integer.toHexString(ch) + " "); }
You can also use %H format string:
for (char ch : "12.013".toCharArray()) { System.out.format("%H ", ch); }
source share