Here you can find the source of byteToHexString(byte value)
public static String byteToHexString(byte value)
//package com.java2s; public class Main { final protected static char[] hexArray = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; public static String byteToHexString(byte value) { int unsigned = value & 0xFF; return "" + hexArray[unsigned >>> 4] + hexArray[unsigned & 0x0F]; }/*from w w w.j av a 2s . co m*/ }