Java tutorial
//package com.java2s; import java.util.Formatter; public class Main { public static String hexEncode(byte[] in) { StringBuilder builder = new StringBuilder(in.length * 2); Formatter formatter = new Formatter(builder); for (byte inByte : in) { formatter.format("%02x", inByte); } return builder.toString(); } }