Here you can find the source of toHexString(byte[] digestByte)
public static String toHexString(byte[] digestByte)
//package com.java2s; //License from project: Open Source License public class Main { public static String toHexString(byte[] digestByte) { return new String(toHex(digestByte)); }/*from w ww. j a v a 2s . c om*/ public static byte[] toHex(byte[] digestByte) { byte[] rtChar = new byte[digestByte.length * 2]; for (int i = 0; i < digestByte.length; i++) { byte b1 = (byte) (digestByte[i] >> 4 & 0x0f); byte b2 = (byte) (digestByte[i] & 0x0f); rtChar[i * 2] = (byte) (b1 < 10 ? b1 + 48 : b1 + 55); rtChar[i * 2 + 1] = (byte) (b2 < 10 ? b2 + 48 : b2 + 55); } return rtChar; } }