版权声明:本博文仅供学习、参考、技术讨论,版权归笔者/译者所有。 https://blog.csdn.net/qq_38025219/article/details/88838805
/**
* 数组转成十六进制字符串
* @param byte[]
* @return HexString
*/
public static String toHexString1(byte[] b){
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < b.length; ++i){
buffer.append(toHexString1(b[i]));
}
return buffer.toString();
}
public static String toHexString1(byte b){
String s = Integer.toHexString(b & 0xFF);
if (s.length() == 1){
return "0" + s;
}else{
return s;
}
}