Here you can find the source of toString(T[] array)
public static <T> String toString(T[] array)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; public class Main { public static <T> String toString(Collection<T> collection) { if (collection == null) { return "NULL"; }//from w w w.j a v a 2 s . c om String out = "[ "; int count = 1; for (T object : collection) { if (object == null) continue; out = out + object.toString(); if (collection.size() != count) { out = out + ";\n"; } count++; } out = out + " ]"; return out; } public static <T> String toString(T[] array) { return toString(Arrays.asList(array)); } public static <T> List<T> asList(Collection<T> collection) { return new ArrayList<T>(collection); } }