Here you can find the source of byte2HexString(byte[] b)
public static String byte2HexString(byte[] b)
//package com.java2s; public class Main { public static String byte2HexString(byte[] b) { StringBuffer sb = new StringBuffer(); int length = b.length; for (int i = 0; i < b.length; i++) { String stmp = Integer.toHexString(b[i] & 0xff); if (stmp.length() == 1) sb.append("0" + stmp); else/*from w w w .j a v a 2s.com*/ sb.append(stmp); } return sb.toString(); } }