Here you can find the source of join(List extends Object> items, String separator)
public static String join(List<? extends Object> items, String separator)
//package com.java2s; import java.util.List; public class Main { public static String join(List<? extends Object> items, String separator) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < items.size(); i++) { if (i > 0) { sb.append(separator);/*from w w w .j a v a 2 s . c o m*/ } sb.append(items.get(i).toString()); } return sb.toString(); } public static String join(float[] items, String separator) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < items.length; i++) { if (i > 0) { sb.append(separator); } sb.append(String.format("%.6f", items[i])); } return sb.toString(); } public static String join(int[] items, String separator) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < items.length; i++) { if (i > 0) { sb.append(separator); } sb.append(String.format("%d", items[i])); } return sb.toString(); } }