Here you can find the source of toHex(StringBuilder s, byte b)
public static void toHex(StringBuilder s, byte b)
//package com.java2s; //License from project: Open Source License public class Main { public static void toHex(StringBuilder s, byte b) { char hi = Character.forDigit((b >> 4) & 0x0F, 16); char lo = Character.forDigit(b & 0x0F, 16); s.append(Character.toUpperCase(hi)); s.append(Character.toUpperCase(lo)); }// ww w.j ava2 s . c o m }