Here you can find the source of intArrayToString(int[] a, String separator)
public static String intArrayToString(int[] a, String separator)
//package com.java2s; //License from project: Open Source License public class Main { public static String intArrayToString(int[] a, String separator) { int len = a.length; if (len == 0) { return "[]"; }//from w ww .j ava 2s. co m StringBuilder builder = new StringBuilder(); builder.append("[ ").append(a[0]); if (len > 1) { for (int i = 1; i < a.length; i++) { builder.append(separator).append(a[i]); } } builder.append(" ]"); return builder.toString(); } }