Here you can find the source of byteToHex(byte b)
public static String byteToHex(byte b)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); public class Main { private static final String HEX = "0123456789ABCDEF"; public static String byteToHex(byte b) { int high = (b & 0xF0) >> 4; int low = (b & 0x0F); return "" + HEX.charAt(high) + HEX.charAt(low); }/*from w w w .ja v a 2s. c om*/ }