Here you can find the source of join(String[] stringArray, boolean quote, String glue)
public static String join(String[] stringArray, boolean quote, String glue)
//package com.java2s; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Main { public static String join(List<?> list, boolean quote, String glue) { if (glue == null) { glue = ","; }//from w ww.j av a 2s.co m String joinedList = ""; int count = 0; for (Object o : list) { if (o == null) { continue; } String s = o.toString(); if (count > 0) { joinedList += glue; } count++; joinedList += quote ? quote(s) : s; } return joinedList; } public static String join(List<?> list) { return join(list, false, ","); } public static String join(List<?> list, String glue) { return join(list, false, glue); } public static String join(String glue, String... strings) { List<String> list = new ArrayList<String>(); for (String s : strings) { list.add(s); } return join(list, false, glue); } public static String join(String[] stringArray, boolean quote, String glue) { return join(Arrays.asList(stringArray), quote, glue); } public static String join(String[] stringArray) { return join(Arrays.asList(stringArray)); } public static String join(String[] stringArray, String glue) { return join(Arrays.asList(stringArray), false, glue); } public static String quote(String s) { return isEmpty(s) ? "" : '"' + s + '"'; } public static boolean isEmpty(String s) { return s == null || s.isEmpty(); } }