Here you can find the source of byteToHexString(byte b)
private static String byteToHexString(byte b)
//package com.java2s; //License from project: Apache License public class Main { private static final char[] ac = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; private static String byteToHexString(byte b) { char[] ch = new char[2]; ch[0] = ac[(b >>> 4 & 0xF)]; ch[1] = ac[(b & 0xF)];/*w ww . j ava 2 s . c o m*/ String s = new String(ch); return new String(ch); } }