Here you can find the source of joiner(int[] ints, String split)
public static String joiner(int[] ints, String split)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { private static final String EMPTY = ""; private static final String NULL = "null"; public static String joiner(int[] ints, String split) { if (ints.length == 0) { return EMPTY; }//from w w w. java 2 s. c o m StringBuilder sb = new StringBuilder(String.valueOf(ints[0])); for (int i = 1; i < ints.length; i++) { sb.append(split); sb.append(ints[i]); } return sb.toString(); } public static String joiner(double[] doubles, String split) { if (doubles.length == 0) { return EMPTY; } StringBuilder sb = new StringBuilder(String.valueOf(doubles[0])); for (int i = 1; i < doubles.length; i++) { sb.append(split); sb.append(doubles[i]); } return sb.toString(); } public static String joiner(float[] floats, String split) { if (floats.length == 0) { return EMPTY; } StringBuilder sb = new StringBuilder(String.valueOf(floats[0])); for (int i = 1; i < floats.length; i++) { sb.append(split); sb.append(floats[i]); } return sb.toString(); } public static String joiner(long[] longs, String split) { if (longs.length == 0) { return EMPTY; } StringBuilder sb = new StringBuilder(String.valueOf(longs[0])); for (int i = 1; i < longs.length; i++) { sb.append(split); sb.append(longs[i]); } return sb.toString(); } public static String joiner(Collection<?> c, String split) { Iterator<?> iterator = c.iterator(); if (!iterator.hasNext()) { return EMPTY; } StringBuilder sb = new StringBuilder(iterator.next().toString()); while (iterator.hasNext()) { sb.append(split); sb.append(toString(iterator.next()).toString()); } return sb.toString(); } public static String toString(Object obj) { if (obj == null) { return NULL; } else { return obj.toString(); } } }