Here you can find the source of join(Collection parts, String sep)
static public String join(Collection parts, String sep)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { static public String join(Collection parts, String sep) { StringBuffer sb = new StringBuffer(); int counter = 0; for (Object o : parts) { if (counter != 0) { sb.append(sep);/*ww w.j a va 2 s . c om*/ } sb.append(o); counter++; } return sb.toString(); } }