Here you can find the source of byteToHex(final byte[] bytes)
public static String byteToHex(final byte[] bytes)
//package com.java2s; //License from project: Apache License import java.util.Formatter; public class Main { public static String byteToHex(final byte[] bytes) { Formatter formatter = new Formatter(); for (byte b : bytes) { formatter.format("%02x", b); }//from w ww.j a v a 2 s. c om String result = formatter.toString(); formatter.close(); return result; } }