java实现python bytes.fromhex()函数,将hex字符串转换为字节
//Tribute to python public static byte[] bytesFromHex(String hexStr) { int len = hexStr.length()/2; byte[] result = new byte[len]; for (int i = 0; i < len; i++) { result[i]=Byte.parseByte(hexStr.substring(i*2,i*2+2),16); } return result; }