Here you can find the source of toHexString(byte b[])
public static String toHexString(byte b[])
//package com.java2s; public class Main { private static final String HEX_CHARS = "0123456789abcdef"; public static String toHexString(byte b[]) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < b.length; i++) { sb.append(HEX_CHARS.charAt(b[i] >>> 4 & 0xf)); sb.append(HEX_CHARS.charAt(b[i] & 0xf)); }/*from w w w . ja v a 2 s . co m*/ return sb.toString(); } }