Here you can find the source of formatHexToString(byte[] bytes)
public static String formatHexToString(byte[] bytes)
//package com.java2s; //License from project: Open Source License public class Main { public static String formatHexToString(byte[] bytes) { StringBuffer buffer = new StringBuffer(); buffer.append("["); for (byte b : bytes) { buffer.append(String.format("0x%02X,", b)); }//from www. ja v a 2s . c om buffer.append("]"); return buffer.toString(); } }