Java tutorial
//package com.java2s; import java.nio.charset.Charset; import javax.xml.bind.DatatypeConverter; public class Main { private final static Charset CHARSET_UTF8 = Charset.forName("UTF-8"); /** * * @param content * @return */ public static String parseHexBinary(String content) { return parseHexBinary(content, CHARSET_UTF8); } /** * * @param content * @param charset * @return */ public static String parseHexBinary(String content, Charset charset) { String converted = content; if (content != null && !content.isEmpty()) { converted = new String(DatatypeConverter.parseHexBinary(content), charset); } return converted; } /** * * @param array * @return */ public static String[] parseHexBinary(String[] array) { return parseHexBinary(array, CHARSET_UTF8); } /** * * @param array * @param charset * @return */ public static String[] parseHexBinary(String[] array, Charset charset) { if (array == null || array.length == 0) { return array; } String[] convertedArray = new String[array.length]; for (int i = 0; i < array.length; i++) { convertedArray[i] = parseHexBinary(array[i], charset); } return convertedArray; } }