Here you can find the source of byte2hex(byte[] b)
public static String byte2hex(byte[] b)
//package com.java2s; public class Main { public static String byte2hex(byte[] b) { String hs = ""; String stmp = ""; for (int n = 0; n < b.length; n++) { stmp = (java.lang.Integer.toHexString(b[n] & 0XFF)); if (stmp.length() == 1) hs = hs + "0" + stmp; else//ww w . jav a 2 s. c o m hs = hs + stmp; } return hs.toUpperCase(); } }