Here you can find the source of joinString(String delimiter, String[] strings)
public static String joinString(String delimiter, String[] strings)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Arrays; public class Main { public static String joinString(String delimiter, String[] strings) { ArrayList<String> list = new ArrayList<String>(Arrays.asList(strings)); list.removeAll(Arrays.asList("", null)); int len = list.size(); if (len == 1) { return list.get(0); }/*www. j a va2 s . c o m*/ StringBuilder sb = new StringBuilder(); --len; for (int i = 0; i < len; i++) { sb.append(list.get(i)); sb.append(delimiter); } sb.append(list.get(len)); return sb.toString(); } }