### Question:
StringUtilities { public static int[] getIndexes(final String s, final char occ) { int pos = s.indexOf(occ); if (pos <0) { return EMPTY_INT_ARRAY; } else { int[] indexes = new int[]{pos}; pos = s.indexOf(occ, pos+1); for(; pos >= 0; pos = s.indexOf(occ, pos+1)){ int end = indexes.length; indexes = ArraysExt.resize(indexes, end+1); indexes[end] = pos; } return indexes; } } private  StringUtilities(); static String MD5encode(final String key); static String clean(String s); static List<String> cleanCharSequences(final List<String> list); static boolean containsIgnoreCase(final List<String> list, final String str); static String firstToUpper(final String s); static int[] getIndexes(final String s, final char occ); static String htmlEncodeSpecialChars(final String text); static boolean matchesStringfromList(final List<String> list,final String str); static String replacePrefix(final String s, final String localPart, final String prefix); @Deprecated static String removeXmlns(final String xml); static String removePrefix(String s); static String toCommaSeparatedValues(final Collection<?> values); static String toCommaSeparatedValues(final Object ... values); static List<String> toStringList(final String commaSeparatedString); @Deprecated static List<String> toStringList(String toSplit, final char separator); static String toString(final Iterable<?> collection, final String separator); static String transformCodeName(String code); static String toStringTree(final Object ... objects); static String toStringTree(String root, final Iterable<?> objects); static String X364toHTML(final String text); static final String TREE_BLANK; static final String TREE_LINE; static final String TREE_CROSS; static final String TREE_END; }### Answer:
@Test public void positionsTest() { String str; int[] nb; str = "gredgfdgdfhdkljgfdhvndkvfduhnfjfiodj"; nb = StringUtilities.getIndexes(str, '-'); assertEquals(0, nb.length); str = "-gredgfdg-dfhdkljgfdh-vndkvfduhnfjf-iodj-"; nb = StringUtilities.getIndexes(str, '-'); assertEquals(5, nb.length); assertEquals(0, nb[0]); assertEquals(9, nb[1]); assertEquals(21, nb[2]); assertEquals(35, nb[3]); assertEquals(40, nb[4]); str = "---"; nb = StringUtilities.getIndexes(str, '-'); assertEquals(3, nb.length); assertEquals(0, nb[0]); assertEquals(1, nb[1]); assertEquals(2, nb[2]); }