Here you can find the source of byteToHex(final byte value)
public static String byteToHex(final byte value)
//package com.java2s; //License from project: Open Source License public class Main { public static String byteToHex(final byte value) { if ((value & 0xFF) < 16) { return "0" + Integer.toHexString(value & 0xFF); } else {/* w w w . jav a 2 s . c om*/ return Integer.toHexString(value & 0xFF); } } }