Here you can find the source of byteToHex(byte b)
public static String byteToHex(byte b)
//package com.java2s; //License from project: Open Source License public class Main { private static String[] hexNums = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" }; public static String byteToHex(byte b) { // String s = "" ; // s += hexNums[b>>4&0x0f] ; // s += hexNums[b&0x0f] ; return hexNums[b >> 4 & 0x0f] + hexNums[b & 0x0f]; }//from w ww . j a v a 2 s . c o m }