Here you can find the source of byteToHexString(byte _b)
public static String byteToHexString(byte _b)
//package com.java2s; //License from project: Open Source License public class Main { private static final char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; public static String byteToHexString(byte _b) { if ((_b < 0) || (_b > 0xf)) { return Integer.toHexString(_b & 0xFF); } else {//from w ww.j a va2 s.co m StringBuffer sb = new StringBuffer(); sb.append('0'); sb.append(hexChars[_b]); return sb.toString(); } } }