Here you can find the source of join(T[] array, String separator)
public static <T> String join(T[] array, String separator)
//package com.java2s; /*//w ww.ja v a2s . c o m * Copyright (c) 2012 The ANTLR Project. All rights reserved. * Use of this file is governed by the BSD-3-Clause license that * can be found in the LICENSE.txt file in the project root. */ import java.util.Arrays; import java.util.Iterator; public class Main { /** * @sharpen.ignore */ public static String join(Iterable<?> iter, String separator) { return join(iter.iterator(), separator); } /** * @sharpen.ignore */ public static <T> String join(T[] array, String separator) { return join(Arrays.asList(array), separator); } /** * @sharpen.ignore */ public static <T> String join(Iterator<T> iter, String separator) { StringBuilder buf = new StringBuilder(); while (iter.hasNext()) { buf.append(iter.next()); if (iter.hasNext()) { buf.append(separator); } } return buf.toString(); } }