Java tutorial
//package com.java2s; public class Main { public static String toHexString(byte[] input) { StringBuffer sb = new StringBuffer(input.length); String sTemp; for (int i = 0; i < input.length; i++) { sTemp = Integer.toHexString(0xFF & input[i]); if (sTemp.length() < 2) sb.append(0); sb.append(sTemp.toUpperCase()); } return sb.toString(); } }