Here you can find the source of implode(double[] array, String separator)
public static String implode(double[] array, String separator)
//package com.java2s; import java.util.Arrays; public class Main { public static String implode(double[] array, String separator) { StringBuffer out = new StringBuffer(); boolean first = true; for (double v : array) { if (first) { first = false;/* www .j a va 2 s. co m*/ } else { out.append(separator); } out.append(v); } return out.toString(); } public static String implode(Object[] values) { return implode(values, ", "); } public static String implode(Object[] values, Object separator) { return implode(Arrays.asList(values), separator); } public static final <T> String implode(Iterable<T> elements, Object separator) { String sepStr = separator.toString(); StringBuilder out = new StringBuilder(); boolean first = true; for (Object s : elements) { if (s == null) { continue; } if (first) { first = false; } else { out.append(sepStr); } out.append(s); } return out.toString(); } public static final String implode(Iterable<?> strings) { return implode(strings, ", "); } }