包名稱:org.apache.commons.codec.binary
類名稱:org.apache.commons.codec.binary.Hex
1、字節數組(byte[])轉為十六進制(Hex)字符串
public static String byte2hex(byte[] input) { return Hex.encodeHexString(input); }
2、十六進制字符串(Hex)轉字節數字(byte[])
public static byte[] hex2byte(String input) { return Hex.decodeHex(input.toCharArray()); }
