Here you can find the source of byteToHex(byte b)
public static String byteToHex(byte b)
//package com.java2s; public class Main { public static String byteToHex(byte b) { return String.format("0x%02X", b); }// w w w . j a v a 2s . c o m }