Here you can find the source of bytesToHexString(byte[] bytesArray)
public static StringBuilder bytesToHexString(byte[] bytesArray)
//package com.java2s; public class Main { public static StringBuilder bytesToHexString(byte[] bytesArray) { if (bytesArray == null) { return null; }//from w w w . ja va 2 s. c o m StringBuilder sBuilder = new StringBuilder(); for (byte b : bytesArray) { String hv = String.format("%02x", b); sBuilder.append(hv); } return sBuilder; } }