How to convert hex string to Java string?

hex, java, string

Solution

Using `Hex` in Apache Commons:

String hexString = "fd00000aa8660b5b010006acdc0100000101000100010000";    
byte[] bytes = Hex.decodeHex(hexString.toCharArray());
System.out.println(new String(bytes, "UTF-8"));

Problem

For logging purpose we are converting the logs to byte array and then to hex string. I want to get it back in a Java String, but I am not able to do so. The hex string in log file looks something like ``` fd00000aa8660b5b010006acdc0100000101000100010000 ``` How can I decode this?

Original source