Java tutorial
//package com.java2s; public class Main { private static String toHexString(byte[] bytes) { StringBuilder hexString = new StringBuilder(); for (byte b : bytes) { String str = Integer.toHexString(0xFF & b); while (str.length() < 2) { str = "0" + str; } hexString.append(str); } return hexString.toString(); } }