Here you can find the source of arrayToString(Object[] objects)
public static String arrayToString(Object[] objects)
//package com.java2s; /*// ww w . j a va 2s. c o m * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved. * * This software is open source. * See the bottom of this file for the licence. * * $Id: StringUtils.java,v 1.1.1.1 2001/05/22 08:13:01 jstrachan Exp $ */ public class Main { /** Pretty print an array of objects as [ object1.toString,() object2.toString(), ... ] */ public static String arrayToString(Object[] objects) { int num = objects.length; if (num == 0) { return "[]"; } else { StringBuffer buffer = new StringBuffer("[ "); for (int i = 0; i < num; i++) { if (i > 0) { buffer.append(", "); } Object object = objects[i]; if (object != null) { buffer.append(object.toString()); } else { buffer.append("null"); } } buffer.append(" ]"); return buffer.toString(); } } }