Here you can find the source of bytesToHex(byte[] b)
public static String bytesToHex(byte[] b)
//package com.java2s; //License from project: Open Source License public class Main { public static String bytesToHex(byte[] b) { String result = ""; for (int i = 0; i < b.length; i++) { result += Integer.toString((b[i] & 0xff) + 0x100, 16).substring(1); }/*from w w w.j a v a2 s . c o m*/ return result; } }