Here you can find the source of join(String separator, Object... texts)
public static String join(String separator, Object... texts)
//package com.java2s; //License from project: BSD License import java.util.List; public class Main { public static String join(List<?> texts, String separator) { StringBuilder result = new StringBuilder(); for (Object text : texts) { result.append(text);// w w w.jav a 2 s.co m result.append(separator); } return result.toString(); } public static String join(String separator, Object... texts) { StringBuilder result = new StringBuilder(); boolean isFirst = true; for (Object text : texts) { if (isFirst) { result.append(separator); isFirst = false; } result.append(text); } return result.toString(); } }