Here you can find the source of join(String[] stringArray, String delimiterString, boolean joinNullValues)
public static String join(String[] stringArray, String delimiterString, boolean joinNullValues)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static String join(String[] stringArray, String delimiterString, boolean joinNullValues) { List<String> list = new ArrayList<String>(); for (int i = 0; stringArray != null && i < stringArray.length; i++) { list.add(stringArray[i]);//from w ww .j a v a2 s.c om } return join(list, delimiterString, joinNullValues); } public static String join(List<String> stringList, String delimiterString, boolean joinNullValues) { String retStr = ""; for (int i = 0; stringList != null && i < stringList.size(); i++) { String stringElem = null; if (stringList.get(i) != null) retStr += stringList.get(i); if (i < stringList.size() - 1) { if (joinNullValues && stringElem == null) retStr += delimiterString; else if (stringElem != null) retStr += delimiterString; } } return retStr; } }