Here you can find the source of byte2HexStr(byte[] b)
public static String byte2HexStr(byte[] b)
//package com.java2s; public class Main { public static String byte2HexStr(byte[] b) { String hs = "0x"; String stmp = ""; for (int n = 0; n < b.length; n++) { stmp = (Integer.toHexString(b[n] & 0XFF)); if (stmp.length() == 1) hs = hs + "0" + stmp; else/*from ww w. j av a 2 s . co m*/ hs = hs + stmp; hs = hs + ", 0x"; } return hs.toUpperCase(); } }