Here you can find the source of join(String[] array, String delim)
public static String join(String[] array, String delim)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { /**//ww w . j av a 2 s . c o m * Concatenates all the elements in the given list of strings, using the * given delimiter. */ public static String join(List<String> list, String delim) { StringBuffer sb = join(list.toArray(new String[0]), delim, new StringBuffer()); return sb.toString(); } /** * Concatenates all the elements in the given array, using the given * delimiter. */ public static String join(String[] array, String delim) { StringBuffer sb = join(array, delim, new StringBuffer()); return sb.toString(); } /** * Concatenates all the elements in the given array, using the given * delimiter. The result is appended to the given string buffer, which is * therefore modified in place. */ public static StringBuffer join(String[] array, String delim, StringBuffer sb) { if (sb == null) sb = new StringBuffer(); for (int i = 0; i < array.length; i++) { if (i != 0) sb.append(delim); sb.append(array[i]); } return sb; } }