Java tutorial
//package com.java2s; public class Main { final static char hexDigit[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; public static String toHexString(byte[] bytes) { StringBuilder str = new StringBuilder(); for (int i = 0; i < bytes.length; i++) str.append(byteToHex(bytes[i])); return str.toString(); } static public String byteToHex(byte b) { char[] array = { hexDigit[(b >> 4) & 0x0f], hexDigit[b & 0x0f] }; return new String(array); } }