private static final String STR = "0123456789abcdef";
/**
* 16进制转字符
* @param hexStr (“010000000000”)
* @return
*/
private static String hexStr2Str(String hexStr) {
char[] hexs = hexStr.toCharArray();
byte[] bytes = new byte[hexStr.length() / 2];
int n;
for (int i = 0; i < bytes.length; i++) {
n = STR.indexOf(hexs[2 * i]) * 16;
n += STR.indexOf(hexs[2 * i + 1]);
bytes[i] = (byte) (n & 0xff);
}
return new String(bytes);
}
版权声明:本文为weixin_57209235原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。