code: public static void checkState(
              boolean expression, String messageFormat, Object... messageArgs) {
          if (!expression) {
              throw new IllegalStateException(format(messageFormat, messageArgs));
          }
      }
docs: Checks the truth of the given expression and throws a customized
  {@link IllegalStateException} if it is false. Intended for doing validation in methods
  involving the state of the calling instance, but not involving parameters of the calling
  method, e.g.:
  <blockquote><pre>
  public void unlock() {
  Preconditions.checkState(locked,
  "Must be locked to be unlocked. Most recent lock: %s",
  mostRecentLock);
  }
  </pre></blockquote>
  
  @param expression the precondition to check involving the state of the calling instance
  @param messageFormat a {@link Formatter format} string for the detail message to be used in
  the event that an exception is thrown.
  @param messageArgs the arguments referenced by the format specifiers in the
  {@code messageFormat}
  @throws IllegalStateException if {@code expression} is false