Here you can find the source of arrayToString(Object[] array, String prefix, String suffix, String separator)
public static String arrayToString(Object[] array, String prefix, String suffix, String separator)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static String arrayToString(Object[] array, String prefix, String suffix, String separator) { return listToString(arrayToList(array), prefix, suffix, separator); }/* w w w . j a va 2 s. c om*/ public static String listToString(List list, String prefix, String suffix, String separator) { if (list == null) return null; return iteratorToString(list.iterator(), prefix, suffix, separator); } public static List arrayToList(Object[] objs) { if (objs == null) return null; List ret = new ArrayList(objs.length); for (Object obj : objs) { ret.add(obj); } return ret; } public static String iteratorToString(Iterator i, String prefix, String suffix, String separator) { StringBuffer sb = new StringBuffer(); boolean first = true; for (; i.hasNext();) { if (first) { first = false; } else sb.append(separator); sb.append(prefix); sb.append(i.next().toString()); sb.append(suffix); } return sb.toString(); } }