Here you can find the source of join(String delimiter, String[] array)
public static String join(String delimiter, String[] array)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String join(String delimiter, String[] array) { StringBuilder sb = new StringBuilder(); int counter = 0; for (String element : array) { sb.append(counter++ > 0 ? delimiter : ""); sb.append(element);//from ww w.j a va 2s. co m } return sb.toString(); } public static String join(String delimiter, List<String> list) { StringBuilder sb = new StringBuilder(); int counter = 0; for (String element : list) { sb.append(counter++ > 0 ? delimiter : ""); sb.append(element); } return sb.toString(); } }