Here you can find the source of objectToString(Object obj, String defaultvalue)
public static final String objectToString(Object obj, String defaultvalue)
//package com.java2s; public class Main { public static final String objectToString(Object obj, String defaultvalue) { if (null == obj) { return defaultvalue; }/*from w ww . java 2 s . co m*/ try { return obj.toString(); } catch (Exception e) { return defaultvalue; } } public static String toString(String[] content, String sign) { if (null == content) { return null; } sign = null == sign ? "," : sign; StringBuilder strBuilder = new StringBuilder(); for (int i = 0; i < content.length; i++) { strBuilder.append(content[i]); if (i < content.length - 1) { strBuilder.append(sign); } } return strBuilder.toString(); } }