code: private static void checkOffset(String value, int offset, char expected) throws IndexOutOfBoundsException {
          char found = value.charAt(offset);
          if (found != expected) {
              throw new IndexOutOfBoundsException("Expected '" + expected + "' character but found '" + found + "'");
          }
      }
docs: Check if the expected character exist at the given offset of the
  
  @param value    the string to check at the specified offset
  @param offset   the offset to look for the expected character
  @param expected the expected character
  @throws IndexOutOfBoundsException if the expected character is not found