Here you can find the source of objectToString(Object[] obj)
public static String objectToString(Object[] obj)
//package com.java2s; //License from project: Open Source License public class Main { public static String objectToString(Object[] obj) { if (obj == null) { return ""; }// w w w . ja v a 2 s . c om StringBuffer sb = new StringBuffer(); for (int i = 0; i < obj.length; i++) { if (obj[i] == null) { sb.append("null,"); continue; } try { sb.append((String) obj[i] + ","); } catch (Exception e) { sb.append(obj[i].toString() + ","); } } return sb.toString(); } public static String toString(Object object, String defaultvalue) { if (object == null) { return defaultvalue; } if (object instanceof String) { return (String) object; } return object.toString(); } public static String toString(Object[] obj) { if (obj == null) { return null; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < obj.length; i++) { sb.append(obj[i]); if (i < obj.length - 1) { sb.append(","); } } return sb.toString(); } }