Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Locale; public class Main { public static String toHex(byte abyte0[]) { StringBuilder stringbuilder = new StringBuilder(2 * abyte0.length); int i = 0; while (i < abyte0.length) { String s = Integer.toHexString(abyte0[i]); if (s.length() == 1) { stringbuilder.append("0"); } else if (s.length() == 8) { s = s.substring(6); } stringbuilder.append(s); i++; } return stringbuilder.toString().toLowerCase(Locale.getDefault()); } }