Here you can find the source of arrayToString(T[] array)
public static <T> String arrayToString(T[] array)
//package com.java2s; //License from project: Open Source License public class Main { public static <T> String arrayToString(T[] array) { return arrayToString(array, ",", "", ""); }//from ww w. j a va2s. c o m public static <T> String arrayToString(T[] array, String connectSymbol) { return arrayToString(array, connectSymbol, "", ""); } public static <T> String arrayToString(T[] array, String leading, String trailing) { return arrayToString(array, ",", leading, trailing); } public static <T> String arrayToString(T[] array, String connectSymbol, String leading, String trailing) { connectSymbol = (connectSymbol == null ? "" : connectSymbol); leading = (leading == null ? "" : leading); trailing = (trailing == null ? "" : trailing); int len = array.length; if (len == 0) return ""; StringBuffer buf = new StringBuffer(len * 12 + leading.length() + trailing.length()); for (int i = 0; i < len - 1; i++) { buf.append(leading).append(array[i].toString()).append(trailing).append(connectSymbol); } return buf.append(leading).append(array[len - 1].toString()).append(trailing).toString(); } }