首页 > 其他分享 >加签

加签

时间:2022-08-29 16:58:13浏览次数:38  
标签:StringBuffer CHARS HEX static sb 0x0F 加签

public static String toHexString(byte[] b) {
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";

标签:StringBuffer,CHARS,HEX,static,sb,0x0F,加签
From: https://www.cnblogs.com/dengjp/p/16636454.html

相关文章