Here you can find the source of bytes2Hex(byte[] bts)
public static String bytes2Hex(byte[] bts)
//package com.java2s; public class Main { public static String bytes2Hex(byte[] bts) { String des = ""; String tmp = null;/* w w w. j a va 2 s . c om*/ for (int i = 0; i < bts.length; i++) { tmp = (Integer.toHexString(bts[i] & 0xFF)); if (tmp.length() == 1) { des += "0"; } des += tmp; } return des; } }