### Question:
StringUtil { public static String join(Object[] values, String joinToken) { if (values == null) { return null; } if (values.length == 0) { return ""; } if (values.length == 1) { return values[0].toString(); } if (joinToken == null) { joinToken = "null"; } StringBuilder sb = new StringBuilder(values.length * (16 + joinToken.length())); sb.append(values[0]); for (int i = 1; i < values.length; i++) { sb.append(joinToken).append(values[i]); } return sb.toString(); } private  StringUtil(); static boolean isEmpty(String val); static boolean isNotEmpty(String val); static boolean isBlank(final CharSequence cs); static boolean isNotBlank(final CharSequence cs); static boolean contains(String val, char charToSearchFor); static boolean equalsIgnoreCase(String str1, String str2); static String[] split(String str, String token, int max); static String replace(String str, String from, String to); static String trim(final String str); static String trimToNull(String str); static String join(Object[] values, String joinToken); static T parse(String val, Class<T> type); static String capitalize(final String str); static String uncapitalize(final String str); static boolean endsWithIgnoreCase(String str, String suffix); static String stripEnd(final String str, final String stripChars);  }### Answer:
@Test public void testStringJoin() { Assert.assertEquals("AAA,BBB,CCC", StringUtil.join(new String[]{"AAA", "BBB", "CCC"}, ",")); Assert.assertEquals("AAA", StringUtil.join(new String[]{"AAA"}, ",")); Assert.assertEquals("AAAnullBBBnullCCC", StringUtil.join(new String[]{"AAA", "BBB", "CCC"}, null)); Assert.assertEquals("", StringUtil.join(new String[]{}, ",")); Assert.assertNull(StringUtil.join(null, null)); Assert.assertNull(StringUtil.join(null, ",")); }
@Test @Ignore("only needed for manual performance tests") public void testStringJoinPerformance() { String[] vals = {"A", "BDS", "DSD", "XYZ", "HOHOHO", "AND", "SOMETHING", "ELSE"}; long start = System.nanoTime(); for (int i = 1; i < 10000000; i++) { StringUtil.join(vals, "-.-"); } long stop = System.nanoTime(); System.out.println("took: " + TimeUnit.NANOSECONDS.toMillis(stop - start)); }