Java tutorial
//package com.java2s; public class Main { private static String byteToHexString(byte[] digest) { StringBuffer hexString = new StringBuffer(); for (int i = 0; i < digest.length; i++) { String hex = Integer.toHexString(digest[i] & 0xFF); if (hex.length() == 1) { hex = '0' + hex; } hexString.append(hex.toUpperCase()); } return hexString.toString(); } }