Here you can find the source of join(String sep, String[] a)
public static String join(String sep, String[] a)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String join(String sep, String[] a) { if (a.length == 0) return ""; if (a.length == 1) return a[0]; StringBuffer sbuff = new StringBuffer(); sbuff.append(a[0]);/*from w ww. j a v a 2 s. c om*/ for (int i = 1; i < a.length; i++) { if (sep != null) sbuff.append(sep); sbuff.append(a[i]); } return sbuff.toString(); } public static String join(String sep, List<String> a) { return join(sep, a.toArray(new String[0])); } }