CharacterUtils { public static int getIndex(char[] characters, char character) { for (int i = 0; i < characters.length; i++) { if (characters[i] == character) { return i; } } return -1; } private  CharacterUtils(); static boolean isWhitespace(char c); static int getIndex(char[] characters, char character); static char[] mergeArrays(char[]... arrays); static char[] arrayOf(char... characters); static boolean belongsTo(char character, char[]... characters); static boolean belongsTo(char character, char... characters); static final char[] DIGITS; static final char[] LETTERS; static final char[] LITERALS; static final char TAB; static final char BACKSPACE; static final char NO_BREAK_SPACE; }
@Test void testGetIndex() { Assertions.assertEquals(-1, CharacterUtils.getIndex(new char[] { 'a', 'b', 'c' }, 'd')); Assertions.assertEquals(1, CharacterUtils.getIndex(new char[] { 'a', 'b', 'c' }, 'b')); }