Here you can find the source of arrayToString(Object[] array, String separator)
public static String arrayToString(Object[] array, String separator)
//package com.java2s; import java.util.List; public class Main { public static String arrayToString(Object[] array, String separator) { if (array == null || array.length == 0) { return ""; }/* www. ja v a 2 s. c o m*/ StringBuffer s = new StringBuffer(32 * array.length); s.append(array[0]); for (int i = 1; i < array.length; i++) { s.append(separator).append(array[i]); } return s.toString(); } public static String arrayToString(List<?> array, String separator) { if (array == null || array.size() == 0) { return ""; } StringBuffer s = new StringBuffer(32 * array.size()); s.append(array.get(0)); for (int i = 1; i < array.size(); i++) { s.append(separator).append(array.get(i)); } return s.toString(); } public static String arrayToString(int[] array, String separator) { if (array == null || array.length == 0) { return ""; } StringBuffer s = new StringBuffer(32 * array.length); s.append(array[0]); for (int i = 1; i < array.length; i++) { s.append(separator).append(array[i]); } return s.toString(); } public static String arrayToString(double[] array, String separator) { if (array == null || array.length == 0) { return ""; } StringBuffer s = new StringBuffer(32 * array.length); s.append(array[0]); for (int i = 1; i < array.length; i++) { s.append(separator).append(array[i]); } return s.toString(); } public static String arrayToString(String[] stringArray, String OutputDelimiter) { int linenum = 0; StringBuffer sb = new StringBuffer(); for (int i = 0; i < stringArray.length; i++) { linenum++; if (linenum == 1) { sb.append(stringArray[i]); } else { sb.append(OutputDelimiter); sb.append(stringArray[i]); } } return sb.toString(); } }