Here you can find the source of getHexStringOfByte(byte[] bytes)
public static String getHexStringOfByte(byte[] bytes)
//package com.java2s; //License from project: Apache License public class Main { public static String getHexStringOfByte(byte[] bytes) { StringBuffer hexValue = new StringBuffer(); for (int i = 0; i < bytes.length; i++) { int val = (bytes[i]) & 0xff; if (val < 16) { hexValue.append("0"); }//from w w w . j a v a 2s .c o m hexValue.append(Integer.toHexString(val)); } return hexValue.toString(); } }