Here you can find the source of bytes2Hex(byte[] b)
public static String bytes2Hex(byte[] b)
//package com.java2s; //License from project: Apache License public class Main { public static String bytes2Hex(byte[] b) { StringBuilder sb = new StringBuilder(1024); for (int n = 0; n < b.length; n++) { String s = Integer.toHexString(b[n] & 0xFF); sb.append((s.length() == 1) ? "0" + s : s); }/*www . ja v a2 s . c om*/ return sb.toString(); } }