Here you can find the source of byteArrayToHexString(byte[] array)
public static String byteArrayToHexString(byte[] array)
//package com.java2s; //License from project: Open Source License public class Main { public static String byteArrayToHexString(byte[] array) { StringBuffer hexString = new StringBuffer(); for (byte b : array) { int intVal = b & 0xff; if (intVal < 0x10) hexString.append("0"); hexString.append(Integer.toHexString(intVal)); }//from w ww. j a va2s .co m return hexString.toString(); } }