Here you can find the source of join(String[] arrayOfString)
public static String join(String[] arrayOfString)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static String join(Collection c) { StringBuilder builder = new StringBuilder(); Iterator itr = c.iterator(); while (itr.hasNext()) { builder.append(itr.next());//from ww w. j a v a2s. c om } return builder.toString(); } public static String join(String[] arrayOfString) { return join(arrayOfString, null); } public static String join(String[] arrayOfString, String separator) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < arrayOfString.length; i++) { builder.append(arrayOfString[i]); if (separator != null && i != arrayOfString.length - 1) builder.append(separator); } return builder.toString(); } }