Java tutorial
//package com.java2s; public class Main { public static String toHexString(byte[] bytes) { StringBuffer buffer = new StringBuffer(); for (byte i : bytes) { buffer.append(Character.forDigit((i >> 4) & 0xF, 16)); buffer.append(Character.forDigit((i & 0xF), 16)); } return buffer.toString(); } }