StringUtils { public static String join(String[] a, char c) { if (a == null) { return null; } if (a.length == 0) { return ""; } StringBuilder sb = new StringBuilder(a[0]); for (int i = 1; i < a.length; i++) { sb.append(c); sb.append(a[i]); } return sb.toString(); }  static String join(String[] a, char c); static Optional<double[]> parseDoubleArray(final String str, final char c); static Optional<int[]> parseIntArray(String str, char c);  }
@Test public void testJoin() { assertNull(StringUtils.join(null, ',')); assertEquals("", StringUtils.join(new String[0], ',')); assertEquals("foo", StringUtils.join(new String[] { "foo" }, ',')); assertEquals("foo,bar", StringUtils.join(new String[] { "foo", "bar" }, ',')); assertEquals("foo,bar,baz", StringUtils.join(new String[] { "foo", "bar", "baz" }, ',')); assertEquals("foo,null,baz", StringUtils.join(new String[] { "foo", null, "baz" }, ',')); assertEquals("foo,,baz", StringUtils.join(new String[] { "foo", "", "baz" }, ',')); }