Here you can find the source of toHexString(byte[] b)
public static String toHexString(byte[] b)
//package com.java2s; //License from project: Apache License public class Main { public static String toHexString(byte[] b) { char[] hexChar = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; StringBuilder sb = new StringBuilder(b.length * 2); for (int i = 0; i < b.length; i++) { sb.append(hexChar[(b[i] & 0xf0) >>> 4]); sb.append(hexChar[b[i] & 0x0f]); }/*from ww w .ja v a 2 s.c o m*/ return sb.toString(); } }