public static void validateVersion(int candidate, int maxExpected)
      throws GeneralSecurityException {
    if (candidate < 0 || candidate > maxExpected) {
      throw new GeneralSecurityException(
          String.format(
              "key has version %d; only keys with version in range [0..%d] are supported",
              candidate, maxExpected));
    }
  }
@throws GeneralSecurityException if {@code candidate} is negative or larger than {@code
    maxExpected}.
java_src/src/main/java/com/google/crypto/tink/subtle/Validators.java