高效的一个字符串转十六进制的方法.
亲测好用!
public static String byte2hexNew(byte[] bytes) {
StringBuilder hex = new StringBuilder();
for (byte b : bytes) {
String hexValue = Integer.toHexString(b & 0xff);
if (hexValue.length() == 1) {
hex.append('0');
}
hex.append(hexValue);
}
return hex.toString().toUpperCase();
}