Java tutorial
//package com.java2s; public class Main { public static String toDisplayString(byte[] bytes) { StringBuilder builder = new StringBuilder(bytes.length); builder.append('['); for (int i = 0; i < bytes.length; i++) { builder.append(bytes[i] + ", "); } builder.append(']'); return builder.toString(); } }