public void valid(Date now) throws CertificateNotYetValidException, CertificateExpiredException {
  Objects.requireNonNull(now);
  if (notBefore != null && notBefore.after(now)) {
    throw new CertificateNotYetValidException("NotBefore: " + notBefore.toString());
  }
  if (notAfter != null && notAfter.before(now)) {
    throw new CertificateExpiredException("NotAfter: " + notAfter.toString());
  }
}

public void valid ( Date now ) throws CertificateNotYetValidException , CertificateExpiredException { Objects . requireNonNull ( now ) ; if ( notBefore != null && notBefore . after ( now ) ) { throw new CertificateNotYetValidException ( "NotBefore: " + notBefore . toString ( ) ) ; } if ( notAfter != null && notAfter . before ( now ) ) { throw new CertificateExpiredException ( "NotAfter: " + notAfter . toString ( ) ) ; } }
verify that that the passed time is within the validity period .
