public static String toHexString(byte[] b) {标签:StringBuffer,CHARS,HEX,static,sb,0x0F,加签 From: https://www.cnblogs.com/dengjp/p/16636454.html
StringBuffer sb = new StringBuffer();
for (int i = 0; i < b.length; i++) {
//& 0x0F 取出后四位
sb.append(HexUtil.HEX_CHARS.charAt(b[i] >>> 4 & 0x0F));
sb.append(HexUtil.HEX_CHARS.charAt(b[i] & 0x0F));
}
return sb.toString();
}
private static final String HEX_CHARS = "0123456789abcdef";