Here you can find the source of join(String separator, Object... objects)
public static String join(String separator, Object... objects)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; import java.util.List; public class Main { public static String join(String separator, Object... objects) { StringBuilder sb = new StringBuilder(); for (Object o : objects) { sb.append(o.toString()).append(separator); }/* w ww . ja va 2 s . c om*/ return sb.toString().trim(); } public static String join(String separator, List<String> tokens) { if (tokens.size() == 1) return tokens.get(0); StringBuilder sb = new StringBuilder(); for (String token : tokens) { sb.append(token).append(separator); } return sb.toString().trim(); } public static String join(String separator, String[] tokens) { return join(separator, Arrays.asList(tokens)); } }