private static String toHexString(byte[] buf) {
if (buf == null || buf.length == 0)
return null;
StringBuilder sb=new StringBuilder(buf.length*2);
for(int i=0;i<buf.length;i++){
sb.append(Integer.toHexString(buf[i]>>4&0xf));
sb.append(Integer.toHexString(buf[i]&0xf));
}
return sb.toString();
}
Java byte数组转16进制字符串
最新推荐文章于 2024-05-26 19:14:38 发布