Here you can find the source of byteToHexString(byte[] b)
public static String byteToHexString(byte[] b)
//package com.java2s; //License from project: LGPL public class Main { public static String byteToHexString(byte[] b) { StringBuffer hexString = new StringBuffer(); for (int i = 0; i < b.length; i++) { String hex = Integer.toHexString(b[i] & 0xFF); if (hex.length() == 1) { hex = '0' + hex; }//from w w w .j ava2 s .c o m hexString.append(hex.toUpperCase()); } return hexString.toString(); } }