Here you can find the source of bytes2Hex(byte bt)
public static String bytes2Hex(byte bt)
//package com.java2s; //License from project: LGPL public class Main { public static String bytes2Hex(byte bt) { return ("" + "0123456789ABCDEF".charAt(0xf & bt >> 4) + "0123456789ABCDEF".charAt(bt & 0xf)); }//from w w w . j a va 2 s . c o m public static String bytes2Hex(byte[] bts) { String des = ""; String tmp = null; for (int i = 0; i < bts.length; i++) { tmp = Integer.toHexString(bts[i] & 0xFF); if (tmp.length() == 1) { des += "0"; } des += tmp; } return des; } }