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