hexString转byteArr
<p>例如：</p>
hexString2Bytes("00A8") returns { 0, (byte) 0xA8 }

@param hexString 十六进制字符串
@return 字节数组
490058
public static byte[] hexString2Bytes(String hexString) {
        if (StringKit.isBlank(hexString)) return null;
        int len = hexString.length();
        if (len % 2 != 0) {
            hexString = "0" + hexString;
            len = len + 1;
        }
        char[] hexBytes = hexString.toUpperCase().toCharArray();
        byte[] ret      = new byte[len >> 1];
        for (int i = 0; i < len; i += 2) {
            ret[i >> 1] = (byte) (hex2Dec(hexBytes[i]) << 4 | hex2Dec(hexBytes[i + 1]));
        }
        return ret;
    }
931564
public static String byteArrayToHexString(byte[] b) {
       StringBuilder resultSb = new StringBuilder();
       for (byte aB : b) {
           resultSb.append(byteToHexString(aB));
       }
       return resultSb.toString();
   }
204855
public static String toHexString(byte[] value) {
    String newString = "";
    for (int i = 0; i < value.length; i++) {
      byte b = value[i];
      String str = Integer.toHexString(b);
      if (str.length() > 2) {
        str = str.substring(str.length() - 2);
      }
      if (str.length() < 2) {
        str = "0" + str;
      }
      newString += str;
    }
    return newString.toUpperCase();
  }
795941
public static String decodeHex(final String hexString) throws DecoderException
	{
		byte[] decodedBytes = HexExtensions.decodeHex(hexString.toCharArray());
		String decodedString = HexExtensions.decodeHex(decodedBytes);
		return decodedString;
	}
910622
private static String byteArrayToHexString(byte[] b)
	{
		StringBuilder sb = new StringBuilder(b.length * 2);
		for (int i = 0; i < b.length; i++)
		{
			int v = b[i] & 0xff;
			if (v < 16)
			{
				sb.append('0');
			}
			sb.append(Integer.toHexString(v));
		}
		return sb.toString().toUpperCase();
	}
992722
public static byte[] asByteArray(String hex) {
        byte[] bts = new byte[hex.length() / 2];
        for (int i = 0; i < bts.length; i++) {
            bts[i] = (byte) Integer.parseInt(hex.substring(2 * i, 2 * i + 2),
                    16);
        }

        return bts;
    }
534835
public static byte[] decodeHex(String hexString) {
    int length = hexString.length();

    if ((length & 0x01) != 0) {
      throw new IllegalArgumentException("Odd number of characters.");
    }

    boolean badHex = false;
    byte[] out = new byte[length >> 1];
    for (int i = 0, j = 0; j < length; i++) {
      int c1 = hexString.charAt(j++);
      if (c1 > 'f') {
        badHex = true;
        break;
      }

      final byte d1 = DIGITS[c1];
      if (d1 == -1) {
        badHex = true;
        break;
      }

      int c2 = hexString.charAt(j++);
      if (c2 > 'f') {
        badHex = true;
        break;
      }

      final byte d2 = DIGITS[c2];
      if (d2 == -1) {
        badHex = true;
        break;
      }

      out[i] = (byte) (d1 << 4 | d2);
    }

    if (badHex) {
      throw new IllegalArgumentException("Invalid hexadecimal digit: " + hexString);
    }

    return out;
  }
331708
public static byte[] fromHexString(String s) {
		if (s.length() % 2 != 0) {
			throw new IllegalArgumentException(s);
		}
		byte[] array = new byte[s.length() / 2];
		for (int i = 0; i < array.length; i++) {
			int b = Integer.parseInt(s.substring(i * 2, i * 2 + 2), SIXTEEN);
			array[i] = (byte) (_0XFF & b);
		}
		return array;
	}
68188
function hex2a(hex) {
  var str = '';
  if (hex){
    var hexstr = hex.toString('ascii');//force conversion
    for (var i = 0; i < hexstr.length; i += 2) {
        //we will display only readable chars
        var intChar = parseInt(hexstr.substr(i,2),16);
        if ((intChar > 31) & (intChar < 127)) {
          str += String.fromCharCode(intChar);
        }
        else {
          str += " ";
        }
    }
  }
  return str;
}
224373
static String toHexString(final byte b) {
		String hexString = Integer.toHexString(b & 0xFF);
		if (hexString.length() % 2 != 0) {
			// Pad with 0
			hexString = "0" + hexString;
		}
		return hexString;
	}
840063
public static String byteArrayToHexString(byte[] b) {
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < b.length; i++) {
			sb.append(byteToHexString(b[i]));
		}
		return new String(sb);
	}
1128254
public static Binary fromHexString(String hex) {
        if (hex.length() % 2 != 0) {
            throw new IllegalArgumentException("Illegal hex string length: " + hex.length());
        }
        final int len = hex.length() / 2;
        final byte[] out = new byte[len];
        for (int i = 0; i < len; ++i) {
            int pos = i * 2;
            String part = hex.substring(pos, pos + 2);
            out[i] = (byte) Integer.parseInt(part, 16);
        }
        return Binary.wrap(out);
    }
201393
private static String bytesToHex(byte[] bytes) {
        char[] hexChars = new char[bytes.length * 2];
        for (int i = 0; i < bytes.length; i++) {
            int v = bytes[i] & 0xFF;
            hexChars[i * 2] = hexArray[v >>> 4];
            hexChars[i * 2 + 1] = hexArray[v & 0x0F];
        }
        return new String(hexChars);
    }
970365
public static String bytes2HexString(byte[] bytes) {
        if (bytes == null) return null;
        int len = bytes.length;
        if (len <= 0) return null;
        char[] ret = new char[len << 1];
        for (int i = 0, j = 0; i < len; i++) {
            ret[j++] = HEX_DIGITS[bytes[i] >>> 4 & 0x0f];
            ret[j++] = HEX_DIGITS[bytes[i] & 0x0f];
        }
        return new String(ret).toLowerCase();
    }
383876
private static String byteToHexString(byte[] bytes)
  {
    final char[] hexArray = "0123456789ABCDEF".toCharArray();
    char[] hexChars = new char[bytes.length * 2];
    for (int j = 0; j < bytes.length; j++)
    {
      int v = bytes[j] & 0xFF;
      hexChars[j * 2] = hexArray[v >>> 4];
      hexChars[j * 2 + 1] = hexArray[v & 0x0F];
    }
    return new String(hexChars);
  }
327279
public final static String toHex(byte [] b) {
	char[] buf = new char[b.length * 2];
	int i, j, k;

	i = j = 0;
	for (; i < b.length; i++) {
	    k = b[i];
	    buf[j++] = hex[(k >>> 4) & 0x0F];
	    buf[j++] = hex[ k & 0x0F];
	}
	return new String(buf);
    }
659862
public static byte[] hex2byte(String hex) {
		byte[] ret = new byte[8];
		byte[] tmp = hex.getBytes();
		for (int i = 0; i < 8; i++) {
			ret[i] = uniteBytes(tmp[i * 2], tmp[i * 2 + 1]);
		}
		return ret;
	}