BracketMatcher { public static int getClosingSquareBracketIndex(CharSequence chars, int startIndex) { return getClosingBracketIndex(chars, startIndex, "[", "]"); }  static int getClosingParenthesisIndex(CharSequence chars, int startIndex); static int getClosingSquareBracketIndex(CharSequence chars, int startIndex); static int getClosingCurlyBraceIndex(CharSequence chars, int startIndex); static int getClosingTagIndex(CharSequence chars, int startIndex); static int getClosingBracketIndex(CharSequence chars, int startIndex, String openBracket, String closeBracket);  }
@Test public void matchSquareBracket() { assertEquals(2, BracketMatcher.getClosingSquareBracketIndex("[a]", 0)); }