Java tutorial
//package com.java2s; public class Main { private static String toHex(byte[] results) { if (results == null) return null; StringBuilder hexString = new StringBuilder(); for (int i = 0; i < results.length; i++) { int hi = (results[i] >> 4) & 0x0f; int lo = results[i] & 0x0f; hexString.append(Character.forDigit(hi, 16)).append(Character.forDigit(lo, 16)); } return hexString.toString(); } }