Here you can find the source of printByteArray(byte[] bytes)
public static String printByteArray(byte[] bytes)
//package com.java2s; //License from project: Apache License public class Main { public static String printByteArray(byte[] bytes) { StringBuilder sb = new StringBuilder(1024); for (byte b : bytes) { sb.append(printByte(b)).append(" "); }//w w w . j av a2 s. co m return sb.toString(); } public static String printByte(byte b) { final String BYTE_FORMAT = "%02x"; return String.format(BYTE_FORMAT, b); } }