Here you can find the source of byteToHexChar(byte b)
private static Object byteToHexChar(byte b)
//package com.java2s; //License from project: Apache License public class Main { private static final String[] hex = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" }; private static Object byteToHexChar(byte b) { int n = b; if (n < 0) { n = 256 + n;//from w w w.ja va 2 s . c o m } int d1 = n / 16; int d2 = n % 16; return hex[d1] + hex[d2]; } }