Here you can find the source of arrayToString(Object[] array)
public static String arrayToString(Object[] array)
//package com.java2s; //License from project: Apache License public class Main { public static String arrayToString(Object[] array) { if (array == null) { return ""; }//from w w w . j a va 2s. c o m StringBuilder sb = new StringBuilder(); sb.append("["); for (Object obj : array) { sb.append(obj == null ? "" : obj.toString()); sb.append(","); } if (sb.indexOf(",") > -1) { sb.deleteCharAt(sb.lastIndexOf(",")); } sb.append("]"); return sb.toString(); } public static String arrayToString(long[] array) { if (array == null) { return ""; } StringBuilder sb = new StringBuilder(); sb.append("["); for (long obj : array) { sb.append(obj); sb.append(","); } if (sb.indexOf(",") > -1) { sb.deleteCharAt(sb.lastIndexOf(",")); } sb.append("]"); return sb.toString(); } }