Here you can find the source of toString(byte[] array)
public static Object toString(byte[] array)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; public class Main { public static String toString(Object[] objects) { StringBuilder str = new StringBuilder(); for (int i = 0; i < objects.length; i++) { str.append(objects[i]);/* ww w . jav a 2 s . c om*/ if (i != objects.length - 1) str.append(", "); } return str.toString(); } public static Object toString(byte[] array) { StringBuilder str = new StringBuilder(); for (int i = 0; i < array.length; i++) { str.append(array[i]); if (i != array.length - 1) str.append(", "); } return str.toString(); } public static Object toString(char[] array) { StringBuilder str = new StringBuilder(); for (int i = 0; i < array.length; i++) { str.append(array[i]); if (i != array.length - 1) str.append(", "); } return str.toString(); } public static Object toString(short[] array) { StringBuilder str = new StringBuilder(); for (int i = 0; i < array.length; i++) { str.append(array[i]); if (i != array.length - 1) str.append(", "); } return str.toString(); } public static Object toString(int[] array) { StringBuilder str = new StringBuilder(); for (int i = 0; i < array.length; i++) { str.append(array[i]); if (i != array.length - 1) str.append(", "); } return str.toString(); } public static Object toString(long[] array) { StringBuilder str = new StringBuilder(); for (int i = 0; i < array.length; i++) { str.append(array[i]); if (i != array.length - 1) str.append(", "); } return str.toString(); } public static Object toString(float[] array) { StringBuilder str = new StringBuilder(); for (int i = 0; i < array.length; i++) { str.append(array[i]); if (i != array.length - 1) str.append(", "); } return str.toString(); } public static Object toString(double[] array) { StringBuilder str = new StringBuilder(); for (int i = 0; i < array.length; i++) { str.append(array[i]); if (i != array.length - 1) str.append(", "); } return str.toString(); } public static String toString(Iterator<?> iteration) { if (iteration == null) return "null"; StringBuilder str = new StringBuilder(); while (iteration.hasNext()) { str.append(iteration.next()); if (iteration.hasNext()) str.append(", "); } return str.toString(); } }