Here you can find the source of join(String delimiter, String[] s)
public static String join(String delimiter, String[] s)
//package com.java2s; //License from project: Apache License import java.util.Arrays; public class Main { public static String join(String delimiter, String[] s) { int ls = s.length; switch (ls) { case 0:// w w w . java2 s . co m return ""; case 1: return s[0]; case 2: return s[0].concat(delimiter).concat(s[1]); default: int l1 = ls / 2; String[] s1 = Arrays.copyOfRange(s, 0, l1); String[] s2 = Arrays.copyOfRange(s, l1, ls); return join(delimiter, s1).concat(delimiter).concat(join(delimiter, s2)); } } }