Here you can find the source of arrayToDelimitedString(T[] array, String left, String delimiter, String right)
public static <T> String arrayToDelimitedString(T[] array, String left, String delimiter, String right)
//package com.java2s; //License from project: Apache License public class Main { public static <T> String arrayToDelimitedString(T[] array, String left, String delimiter, String right) { return arrayToDelimitedString(array, 0, array.length, left, delimiter, right);//from w w w . j a v a 2s .c o m } public static <T> String arrayToDelimitedString(T[] array, int offset, int length, String delimiter) { return arrayToDelimitedString(array, offset, length, "", delimiter, ""); } public static <T> String arrayToDelimitedString(T[] array, String delimiter) { return arrayToDelimitedString(array, 0, array.length, "", delimiter, ""); } public static <T> String arrayToDelimitedString(T[] array, int offset, int length, String left, String delimiter, String right) { StringBuilder buf = new StringBuilder(); for (int i = offset; i < offset + length - 1; i++) { buf.append(left).append(array[i]).append(right) .append(delimiter); } if (length > 0) buf.append(left).append(array[offset + length - 1]) .append(right); return buf.toString(); } }