Here you can find the source of concat(T[] objects)
public static <T> String concat(T[] objects)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static <T> String concat(List<T> objects) { return concat(objects, 0); }/*from www .jav a2 s.com*/ public static <T> String concat(List<T> objects, int beginIndex) { return concat(objects, " ", beginIndex); } public static <T> String concat(List<T> objects, String separator) { return concat(objects, separator, 0); } public static <T> String concat(List<T> objects, String separator, int beginIndex) { return concat(objects.toArray(new Object[objects.size()]), separator, beginIndex); } public static <T> String concat(T[] objects) { return concat(objects, 0); } public static <T> String concat(T[] objects, int beginIndex) { return concat(objects, " ", beginIndex); } public static <T> String concat(T[] objects, String separator) { return concat(objects, separator, 0); } public static <T> String concat(T[] objects, String separator, int beginIndex) { if (objects.length == 0) { return ""; } int index = -1; StringBuilder ret = new StringBuilder(); for (Object s : objects) { index++; if (index >= beginIndex) if (s.toString().length() > 0) { ret.append(separator).append(s); } } return ret.length() >= separator.length() ? ret.substring(separator.length()) : ret.toString(); } }