Here you can find the source of join(String glue, String[] strings)
public static String join(String glue, String[] strings)
//package com.java2s; /*// www .j a v a2 s. co m (C) 2007 Stefan Reich (jazz@drjava.de) This source file is part of Project Prophecy. For up-to-date information, see http://www.drjava.de/prophecy This source file is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 2.1. */ import java.util.*; import static java.util.Arrays.asList; public class Main { public static String join(String glue, String[] strings) { return join(glue, asList(strings)); } public static String join(String glue, Iterable<String> strings) { StringBuffer buf = new StringBuffer(); Iterator<String> i = strings.iterator(); if (i.hasNext()) { buf.append(i.next()); while (i.hasNext()) buf.append(glue).append(i.next()); } return buf.toString(); } }