Java tutorial
//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)); } return hexString.toString(); } }