Here you can find the source of appendHex(StringBuffer buffer, byte b)
private static void appendHex(StringBuffer buffer, byte b)
//package com.java2s; //License from project: Apache License public class Main { private static final char[] hexDigit = "0123456789abcdef".toCharArray(); private static void appendHex(StringBuffer buffer, byte b) { buffer.append(hexDigit[(b >> 4) & 15]).append(hexDigit[b & 15]); }/*from w w w . ja v a 2 s . c o m*/ private static void appendHex(StringBuffer buffer, byte[] b) { for (int i = 0; i < b.length; ++i) buffer.append(hexDigit[(b[i] >> 4) & 15]).append(hexDigit[b[i] & 15]); } }