Here you can find the source of bytesToHex(byte[] bt)
private static String bytesToHex(byte[] bt)
//package com.java2s; //License from project: Open Source License public class Main { private static String bytesToHex(byte[] bt) { StringBuilder stringBuilder = new StringBuilder(); if (bt == null || bt.length <= 0) { return null; }// ww w.j a v a 2 s . c om for (int i = 0; i < bt.length; i++) { int v = bt[i] & 0xFF; String hv = Integer.toHexString(v); if (hv.length() < 2) { stringBuilder.append(0); } stringBuilder.append(hv); } return stringBuilder.toString(); } }