01: package com.technoetic.xplanner.util;
02:
03: public class ToStringUtils {
04: public static String arrayToString(Object[] array) {
05: StringBuffer str = new StringBuffer();
06: if (array.length > 1)
07: str.append("{");
08: for (int i = 0; i < array.length; i++) {
09: if (i != 0)
10: str.append(",");
11: Object o = array[i];
12: str.append(safeToString(o));
13: }
14: if (array.length > 1)
15: str.append("}");
16: return str.toString();
17: }
18:
19: public static String safeToString(Object o) {
20: return o == null ? "null" : o.toString();
21: }
22: }
|