Here you can find the source of printBytes(byte[] bytes)
public static void printBytes(byte[] bytes)
//package com.java2s; //License from project: Apache License public class Main { public static void printBytes(byte[] bytes) { if (bytes == null || bytes.length <= 0) { System.out.println("Empty byte array."); return; }//from w ww. ja v a 2s.c om StringBuilder sb = new StringBuilder(); sb.append("Total length:"); sb.append(bytes.length); sb.append(",["); for (byte b : bytes) { sb.append(b); sb.append(","); } sb.append("]"); System.out.println(sb.toString()); } }