[java] How to convert hex strings to byte values in Java

The simplest way (using Apache Common Codec):

byte[] bytes = Hex.decodeHex(str.toCharArray());