Here you can find the source of array2string(Object[] array)
public static String array2string(Object[] array)
//package com.java2s; //License from project: BSD License public class Main { public static String array2string(Object[] array) { StringBuffer sb = new StringBuffer(""); for (int i = 0; i < array.length - 1; i++) { sb.append(array[i].toString()); sb.append(", "); }/*w w w. ja v a2 s .com*/ if (array.length > 0) sb.append(array[array.length - 1]); return sb.toString(); } public static String array2string(int[] array) { StringBuffer sb = new StringBuffer("[array: "); for (int i = 0; i < array.length - 1; i++) { sb.append(new Integer(array[i]).toString()); sb.append("; "); } if (array.length > 0) sb.append(array[array.length - 1]); sb.append("]"); return sb.toString(); } public static String array2string(char[] array) { StringBuffer sb = new StringBuffer("[array: "); for (int i = 0; i < array.length - 1; i++) { sb.append(new Integer(array[i]).toString()); sb.append("; "); } if (array.length > 0) sb.append(array[array.length - 1]); sb.append("]"); return sb.toString(); } }