Here you can find the source of toPrettyString(String[] array)
public static String toPrettyString(String[] array)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static String toPrettyString(Map map) { StringBuffer buf = new StringBuffer(); buf.append("{"); for (Object key : map.keySet()) { buf.append(key.toString());/*w ww. j a v a 2 s. co m*/ buf.append(" : "); Object val = map.get(key); if (val == null) { buf.append("null"); } else if (val instanceof String[]) { buf.append(toPrettyString((String[]) val)); } else { buf.append(val.toString()); } buf.append(", "); } if (buf.length() > 1) { buf.deleteCharAt(buf.length() - 1); buf.deleteCharAt(buf.length() - 1); } buf.append("}"); return buf.toString(); } public static String toPrettyString(String[] array) { StringBuffer buf = new StringBuffer(); buf.append("["); for (String st : array) { buf.append(st); buf.append(","); } if (buf.length() > 1) ; buf.deleteCharAt(buf.length() - 1); buf.append("]"); return buf.toString(); } }