Java tutorial
//package com.java2s; public class Main { public static String ByteArrayToHexString(byte[] in) { String ret = ""; for (byte b : in) { ret += byteToHexString(b); } return ret; } public static String byteToHexString(byte b) { String ret = ""; int intVal = b & 0xff; if (intVal < 0x10) ret += "0"; ret += Integer.toHexString(intVal); return ret; } }