Here you can find the source of byteArrayToHexString(byte[] b)
public static String byteArrayToHexString(byte[] b)
//package com.java2s; public class Main { private static final String hexDigits = "0123456789abcdef"; public static String byteArrayToHexString(byte[] b) { StringBuffer buf = new StringBuffer(); for (int i = 0; i < b.length; i++) { int j = b[i] & 0xFF; buf.append(hexDigits.charAt(j / 16)); buf.append(hexDigits.charAt(j % 16)); }//w ww. j av a2 s .c o m return buf.toString(); } }