public int getBasicScore ( ) { final BigDecimal guesses = getGuesses ( ) ; if ( guesses . compareTo ( BigDecimal . valueOf ( 1e3 ) ) == - 1 ) return 0 ; else if ( guesses . compareTo ( BigDecimal . valueOf ( 1e6 ) ) == - 1 ) return 1 ; else if ( guesses . compareTo ( BigDecimal . valueOf ( 1e8 ) ) == - 1 ) return 2 ; else if ( guesses . compareTo ( BigDecimal . valueOf ( 1e10 ) ) == - 1 ) return 3 ; else return 4 ; }
This scoring function returns an int from 0 - 4 to indicate the score of this password using the same semantics as zxcvbn .