Here you can find the source of bytes2Hex(byte[] byteArray)
private static String bytes2Hex(byte[] byteArray)
//package com.java2s; public class Main { private static String bytes2Hex(byte[] byteArray) { StringBuffer strBuf = new StringBuffer(); for (int i = 0; i < byteArray.length; i++) { if (byteArray[i] >= 0 && byteArray[i] < 16) { strBuf.append("0"); }//w ww. j a v a 2s . c o m strBuf.append(Integer.toHexString(byteArray[i] & 0xFF)); } return strBuf.toString(); } }