Here you can find the source of arrayToString(String[] strings)
public static String arrayToString(String[] strings)
//package com.java2s; //License from project: Apache License import java.util.Arrays; public class Main { public static String arrayToString(String[] strings) { StringBuffer result = new StringBuffer(""); if ((strings != null) && (strings.length > 0)) { for (int i = 0; i < strings.length; i++) { result.append(strings[i]); if (i < strings.length - 1) { result.append(", "); }//from ww w .j a v a 2 s. co m } } return result.toString(); } public static String toString(Object object, Class<?> objectClass) { if (null == object) { return "null"; } final String toString = object.toString(); if (isStringEmpty(toString)) { return "\"\""; } else if (String.class.equals(objectClass)) { return "\"" + toString + '\"'; } else { return toString; } } /** * Returns the string representation of the specified object, transparently * handling null references and arrays. * * @param obj * the object * @return the string representation */ public static String toString(Object obj) { String result; if (obj != null) { if (obj instanceof boolean[]) { result = Arrays.toString((boolean[]) obj); } else if (obj instanceof byte[]) { result = Arrays.toString((byte[]) obj); } else if (obj instanceof char[]) { result = Arrays.toString((char[]) obj); } else if (obj instanceof double[]) { result = Arrays.toString((double[]) obj); } else if (obj instanceof float[]) { result = Arrays.toString((float[]) obj); } else if (obj instanceof int[]) { result = Arrays.toString((int[]) obj); } else if (obj instanceof long[]) { result = Arrays.toString((long[]) obj); } else if (obj instanceof Object[]) { result = Arrays.deepToString((Object[]) obj); } else if (obj instanceof short[]) { result = Arrays.toString((short[]) obj); } else { result = obj.toString(); } } else { result = "null"; } return result; } public static boolean isStringEmpty(String s) { return s == null || "".equals(s); } }