Here you can find the source of bytes2Hex(byte... values)
public static String bytes2Hex(byte... values)
//package com.java2s; //License from project: Apache License public class Main { public static String bytes2Hex(byte... values) { StringBuffer bf = new StringBuffer(); for (byte b : values) { String str = byte2Hex(b, false); bf.append(str);//from w w w.j a va 2s . com } return bf.toString(); } public static String byte2Hex(byte value, boolean showx) { int value0 = (value & 0xff); String v = Integer.toHexString(value0); if (v.length() % 2 != 0) { v = "0" + v; } return showx ? ("0x" + v) : v; } public static String byte2Hex(byte value) { return byte2Hex(value, true); } }