public static void validateAesKeySize(int sizeInBytes) throws InvalidAlgorithmParameterException {
    if (sizeInBytes != 16 && sizeInBytes != 32) {
      throw new InvalidAlgorithmParameterException(
          String.format(
              "invalid key size %d; only 128-bit and 256-bit AES keys are supported",
              sizeInBytes * 8));
    }
  }
@throws InvalidAlgorithmParameterException if {@code sizeInBytes} is not supported.
java_src/src/main/java/com/google/crypto/tink/subtle/Validators.java