Here you can find the source of appendHex(StringBuffer stringbuffer, byte byte0)
private static void appendHex(StringBuffer stringbuffer, byte byte0)
//package com.java2s; public class Main { /** A table of hex digits */ public static final char[] hexDigit = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; private static void appendHex(StringBuffer stringbuffer, byte byte0) { stringbuffer.append(toHexChar(byte0 >> 4)); stringbuffer.append(toHexChar(byte0)); }/* w w w. j ava 2 s. c o m*/ /** * Convert a nibble to a hex character * * @param nibble * the nibble to convert. */ public static char toHexChar(int nibble) { return hexDigit[(nibble & 0xF)]; } }