「java」byte配列から16進数に変換する

Javaコード
public static String byte2hex(byte[] b) {

StringBuffer sb = new StringBuffer(b.length * 2);
String tmp = “";
for (int n = 0; n < b.length; n++) {
tmp = (java.lang.Integer.toHexString(b[n] & 0XFF));
if (tmp.length() == 1) {
sb.append(“0");
}
sb.append(tmp);
}
return sb.toString().toUpperCase();
}

Java

Posted by arkgame