Here you can find the source of printHex(byte[] b)
public static String printHex(byte[] b)
//package com.java2s; public class Main { public static String printHex(byte[] b) { StringBuffer res = new StringBuffer(); StringBuffer t, t1;//w ww .java2s . c om for (int i = 0; i < b.length; i++) { t = new StringBuffer(Integer.toHexString(b[i])); if (t.length() > 2) { t1 = new StringBuffer(); t1.append(t.charAt(t.length() - 2)); t1.append(t.charAt(t.length() - 1)); t = t1; } res.append(t); } return res.toString(); } }