public boolean isValidHOTP(String enteredHOTPCode){
  if (sentHOTPCode != null && sentHOTPCode.equals(enteredHOTPCode)) {
    long timePassed=currentTimeMillis() - sentHOTPCodeTime;
    if (timePassed <= (codeValidityDuration * 60000)) {
      sentHOTPCode=null;
      return true;
    }
 else {
      if (DEBUG.messageEnabled()) {
        DEBUG.message("HOTP.process() : HOTP code has expired");
      }
      return false;
    }
  }
 else {
    if (DEBUG.messageEnabled()) {
      DEBUG.message("HOTP.process() : HOTP code is not valid");
    }
    return false;
  }
}

public boolean isValidHOTP ( String enteredHOTPCode ) { if ( sentHOTPCode != null && sentHOTPCode . equals ( enteredHOTPCode ) ) { long timePassed = currentTimeMillis ( ) - sentHOTPCodeTime ; if ( timePassed <= ( codeValidityDuration * 60000 ) ) { sentHOTPCode = null ; return true ; } else { if ( DEBUG . messageEnabled ( ) ) { DEBUG . message ( "HOTP.process() : HOTP code has expired" ) ; } return false ; } } else { if ( DEBUG . messageEnabled ( ) ) { DEBUG . message ( "HOTP.process() : HOTP code is not valid" ) ; } return false ; } }
determines if the given otp code matches the otp code that was sent previously .
