public static String hexStringToAsciiString(final String hexString) {
    final String realText = (hexString.length() % 2) == 0 ? hexString : "0" + hexString;

    String asciiString = "";

    for (int i = 0; i < realText.length(); i += 2) {
      final char c1 = realText.charAt(i);
      final char c2 = realText.charAt(i + 1);

      if (!isHexCharacter(c1) || !isHexCharacter(c2)) {
        throw new IllegalArgumentException("Error: Invalid hex string");
      }

      final char code = (char) ((Character.digit(c1, 16) << 4) + Character.digit(c2, 16));

      asciiString += isPrintableCharacter(code) ? code : ".";
    }

    return asciiString;
  }
Converts a hex to ASCII. If the hex string has an odd number of characters, a 0 is added at the
end of the string.

<p>Example: 414141 is converted to AAA

@param hexString The string to convert.
@return The converted ASCII string.
java/zylib/src/main/java/com/google/security/zynamics/zylib/general/Convert.java