StringUtil { public static String toString(Object obj) { if (obj == null) { return "null"; } StringBuilder sb = new StringBuilder(); deepToString(obj, sb); return sb.toString(); }  static String subHead(String str, int maxLen); static String toString(Object obj); static String randomString(int length); static String join(String split, String... args); static String join(String split, Object... args); static String join(String split, Function<T, String> function, Collection<T> args); static String join(String split, Function<T, String> function, T ... args); static boolean isEmpty(String str); static String[] splitRemoveEmpty(String regex, String str); static boolean trimEquals(String str1, String str2, boolean ignoreCase); static boolean trimEquals(String str1, String str2); static String[] splitByLen(String buff, int splitLen); static int compareVersion(String version1, String version2); static String[] splitByLineRemoveEmpty(String str);  }
@Test public void testToString(){ Assert.assertEquals(String.valueOf(Integer.MAX_VALUE), StringUtil.toString(Integer.MAX_VALUE)); int []intArr = new int[]{1, 2, 3}; Assert.assertEquals("[1, 2, 3]", StringUtil.toString(intArr)); Object [] arrInArr = new Object[]{"a", intArr, "b"}; Assert.assertEquals("[a, [1, 2, 3], b]", StringUtil.toString(arrInArr)); }