Here you can find the source of join(List
public static String join(List<Integer> list, String separator)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String join(List<Integer> list, String separator) { if (list == null || list.isEmpty()) return null; StringBuilder sBuilder = new StringBuilder(); for (Integer item : list) { if (item != null) sBuilder.append("," + item.toString()); }/*w w w .j a v a2s .c om*/ sBuilder.deleteCharAt(0); return sBuilder.toString(); } }