Here you can find the source of join(Object[] arr)
public static String join(Object[] arr)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String join(Object[] arr) { return join(arr, ","); }// w ww . j av a 2 s. com public static String join(Object[][] arr) { return join(arr, "\n", ","); } public static String join(Object[] arr, String spliter) { if (arr == null) { return null; } StringBuffer sb = new StringBuffer(); for (int i = 0; i < arr.length; ++i) { if (i != 0) { sb.append(spliter); } sb.append(arr[i]); } return sb.toString(); } public static String join(Object[][] arr, String spliter1, String spliter2) { if (arr == null) { return null; } StringBuffer sb = new StringBuffer(); for (int i = 0; i < arr.length; ++i) { if (i != 0) { sb.append(spliter2); } sb.append(join(arr[i], spliter2)); } return sb.toString(); } public static String join(List list) { return join(list, ","); } public static String join(List list, String spliter) { if (list == null) { return null; } StringBuffer sb = new StringBuffer(); for (int i = 0; i < list.size(); ++i) { if (i != 0) { sb.append(spliter); } sb.append(list.get(i)); } return sb.toString(); } }