Here you can find the source of toHexString(byte[] ba)
private static String toHexString(byte[] ba)
//package com.java2s; //License from project: Apache License public class Main { private static String toHexString(byte[] ba) { StringBuilder str = new StringBuilder(); for (int i = 0; i < ba.length; i++) { str.append(String.format("%x", new Object[] { Byte.valueOf(ba[i]) })); }// w w w . jav a 2s . co m return str.toString(); } }