Here you can find the source of join(String[] lines, String sep)
public static String join(String[] lines, String sep)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String join(String[] lines, String sep) { StringBuilder buf = new StringBuilder(); if (lines != null) for (String line : lines) { if (buf.length() > 0) { buf.append(sep);/*from w w w . ja va2 s . c o m*/ } buf.append(line); } return buf.toString(); } public static String join(List<String> lines, String sep) { return join(lines.toArray(new String[0]), sep); } }