Java tutorial
//package com.java2s; public class Main { public static String encodeHexString(byte abyte0[]) { StringBuilder stringbuilder = new StringBuilder(""); if (abyte0 != null) { for (int i = 0; i < abyte0.length; i++) { Object aobj[] = new Object[1]; aobj[0] = Integer.valueOf(0xff & abyte0[i]); stringbuilder.append(String.format("%02x", aobj)); } } return stringbuilder.toString(); } }