private static boolean isBetweenBrackets(CharSequence text, int offset) {
    return offset < text.length() && isBracket(text.charAt(offset)) && offset > 0 && isBracket(text.charAt(offset - 1));
  }
private static boolean isBetweenBrackets(CharSequence text, int offset)