Here you can find the source of toHex(byte... bytes)
public static String toHex(byte... bytes)
//package com.java2s; //License from project: Open Source License public class Main { public static String toHex(byte... bytes) { String returnString = ""; for (byte b : bytes) { returnString = returnString + String.format("%02x", b) + " "; }/* ww w . j a v a2s . c o m*/ return returnString; } }