Here you can find the source of appendHexPair(byte b, StringBuffer sb)
private static void appendHexPair(byte b, StringBuffer sb)
//package com.java2s; public class Main { public static char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; private static void appendHexPair(byte b, StringBuffer sb) { char c0 = hexDigits[(b & 0xf0) >> 4]; char c1 = hexDigits[b & 0x0f]; sb.append(c0);/*from www.j ava 2 s . com*/ sb.append(c1); } }