Here you can find the source of array2String(Object[] a, int size)
public static String array2String(Object[] a, int size)
//package com.java2s; /*//from w w w . j a va 2s .c o m * Copyright (c) 2016. Pun.W <punyj177 at gmail dot com> * * Everyone is permitted to copy and distribute verbatim or modified copies of this license * document, and changing it is allowed as long as the name is changed. * * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, * DISTRIBUTION AND MODIFICATION * * 0. You just DO WHAT THE FUCK YOU WANT TO. */ public class Main { public static String array2String(Object[] a, int size) { if (a == null) return "null"; int iMax = size - 1; if (iMax == -1) return "[]"; StringBuilder b = new StringBuilder(); b.append('['); for (int i = 0;; i++) { b.append(String.valueOf(a[i])); if (i == iMax) return b.append(']').toString(); b.append(", "); } } }