Here you can find the source of join(String[] sentence, String separator)
public static String join(String[] sentence, String separator)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String join(String[] sentence, String separator) { String result = ""; for (int i = 0; i < sentence.length; i++) { String word = sentence[i]; result += word + separator;/*from w ww .ja v a 2s . c o m*/ } return result.trim(); } public static String join(List<String> sentence, String separator) { String result = ""; for (String word : sentence) { result += word + separator; } return result.trim(); } }