Here you can find the source of join(String[] array, String separator)
public static final String join(String[] array, String separator)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { public static final String join(String[] array, String separator) { StringBuilder sb = new StringBuilder(1024); boolean first = true; for (String item : array) { if (first) { first = false;/* w w w.ja v a 2 s. c om*/ } else { sb.append(separator); } sb.append(item); } return sb.toString(); } public static final String join(Collection<String> list, String separator) { StringBuilder sb = new StringBuilder(1024); boolean first = true; for (String item : list) { if (first) { first = false; } else { sb.append(separator); } sb.append(item); } return sb.toString(); } }