Here you can find the source of join(String[] args, String delimiter)
public static String join(String[] args, String delimiter)
//package com.java2s; // BSD License (http://lemurproject.org/galago-license) import java.util.*; public class Main { /**/* w ww . ja v a 2s .c o m*/ * Returns a string containing all the elements of args, space delimited. */ public static String join(String[] args, String delimiter) { return join(Arrays.asList(args), delimiter); } public static String join(List<String> args, String delimiter) { StringBuilder builder = new StringBuilder(); for (String arg : args) { if (builder.length() > 0) { builder.append(delimiter); } builder.append(arg); } return builder.toString(); } public static String join(String[] args) { return join(args, " "); } public static String join(Object[] args, String delimiter) { StringBuilder builder = new StringBuilder(); for (Object arg : args) { if (builder.length() > 0) { builder.append(delimiter); } builder.append(arg.toString()); } return builder.toString(); } public static String join(double[] numbers) { return join(numbers, ","); } public static String join(double[] numbers, String delimiter) { StringBuilder builder = new StringBuilder(); for (double arg : numbers) { if (builder.length() > 0) { builder.append(delimiter); } builder.append(arg); } return builder.toString(); } public static String join(int[] numbers) { return join(numbers, ","); } public static String join(int[] numbers, String delimiter) { StringBuilder builder = new StringBuilder(); for (int arg : numbers) { if (builder.length() > 0) { builder.append(delimiter); } builder.append(arg); } return builder.toString(); } public static String join(short[] numbers) { return join(numbers, ","); } public static String join(short[] numbers, String delimiter) { StringBuilder builder = new StringBuilder(); for (short arg : numbers) { if (builder.length() > 0) { builder.append(delimiter); } builder.append(arg); } return builder.toString(); } }