Here you can find the source of join(String[] array)
public static String join(String[] array)
//package com.java2s; /*/* w ww . j av a 2s . co m*/ * Copyright 2009-2012 Evun Technology. * * This software is the confidential and proprietary information of * Evun Technology. ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with evun.cn. */ import java.util.Collection; public class Main { public static String join(String[] array) { if (array.length == 0) return ""; StringBuilder sb = new StringBuilder(); for (String s : array) sb.append(s); return sb.toString(); } public static String join(String[] array, char split) { if (array.length == 0) return ""; StringBuilder sb = new StringBuilder(); for (int i = 0; i < array.length; i++) { if (i > 0) sb.append(split); sb.append(array[i]); } return sb.toString(); } public static String join(String[] array, String split) { if (array.length == 0) return ""; StringBuilder sb = new StringBuilder(); for (int i = 0; i < array.length; i++) { if (i > 0) sb.append(split); sb.append(array[i]); } return sb.toString(); } public static String join(Collection<String> coll, String split) { if (coll.isEmpty()) return ""; StringBuilder sb = new StringBuilder(); boolean isFirst = true; for (String s : coll) { if (isFirst) isFirst = false; else sb.append(split); sb.append(s); } return sb.toString(); } public static boolean isEmpty(String str) { if (str == null || str.length() == 0) return true; return false; } }