### Question:
StringUtils { public static String[] split(String str) { String[] tokens = new String[(int) (str.length() / 2) + 1]; int start = 0; int tcount = 0; boolean prevws = false; int ix; for (ix = 0; ix < str.length(); ix++) { if (str.charAt(ix) == ' ') { if (!prevws && ix > 0) tokens[tcount++] = str.substring(start, ix); prevws = true; start = ix + 1; } else prevws = false; } if (!prevws && start != ix) tokens[tcount++] = str.substring(start); String[] tmp = new String[tcount]; for (ix = 0; ix < tcount; ix++) tmp[ix] = tokens[ix]; return tmp; }  static String replaceAnyOf(String value, String chars,
                                    char replacement); static String normalizeWS(String value); static String[] split(String str); static String join(String[] pieces);  }### Answer:
@Test public void testEmpty() { assertEqual(new String[] {}, StringUtils.split("")); }
@Test public void testOneToken() { assertEqual(new String[] {"ab"}, StringUtils.split("ab")); }
@Test public void testTwoTokens() { assertEqual(new String[] {"a", "b"}, StringUtils.split("a b")); }
@Test public void testTwoTokensLeadingTrailing() { assertEqual(new String[] {"a", "b"}, StringUtils.split(" a b ")); }
@Test public void testManySpaces() { assertEqual(new String[] {"aaa", "bbb"}, StringUtils.split("aaa bbb")); }
@Test public void testThreeTokens() { assertEqual(new String[] {"aaa", "bbb", "ccc"}, StringUtils.split("aaa bbb ccc")); }