Here you can find the source of arrayToString(String[] strs, String separator)
public static String arrayToString(String[] strs, String separator)
//package com.java2s; public class Main { public static final String DEFAULT_SEPARATOR = ","; public static String arrayToString(String[] strs, String separator) { if (null == separator || "".equalsIgnoreCase(separator)) { separator = DEFAULT_SEPARATOR; }/*from w w w. ja v a 2 s .com*/ if (strs.length == 0) { return ""; } StringBuffer sbuf = new StringBuffer(); sbuf.append(strs[0]); for (int idx = 1; idx < strs.length; idx++) { sbuf.append(separator); sbuf.append(strs[idx]); } return sbuf.toString(); } }