Here you can find the source of byteToHexString(final byte b)
private static String byteToHexString(final byte b)
//package com.java2s; //License from project: Apache License public class Main { /** Converts the given byte to a (zero-padded, if necessary) hex {@link String}. */ private static String byteToHexString(final byte b) { final String s = Integer.toHexString(b & 0xff); return (s.length() == 1) ? "0" + s : s; }/*from w w w.j a v a 2 s .com*/ }