public static String getTimeToCrackFormatted ( final Result result , final String guess_type ) { ResourceBundle mainResource = result . getConfiguration ( ) . getMainResource ( ) ; BigDecimal seconds = getTimeToCrack ( result , guess_type ) ; BigDecimal minutes = new BigDecimal ( 60 ) ; BigDecimal hours = minutes . multiply ( new BigDecimal ( 60 ) ) ; BigDecimal days = hours . multiply ( new BigDecimal ( 24 ) ) ; BigDecimal months = days . multiply ( new BigDecimal ( 30 ) ) ; BigDecimal years = months . multiply ( new BigDecimal ( 12 ) ) ; BigDecimal centuries = years . multiply ( new BigDecimal ( 100 ) ) ; BigDecimal infinite = centuries . multiply ( new BigDecimal ( 100000 ) ) ; if ( seconds . divide ( infinite , 0 , BigDecimal . ROUND_FLOOR ) . compareTo ( BigDecimal . ONE ) >= 0 ) { return mainResource . getString ( "main.estimate.greaterCenturies" ) ; } else if ( seconds . divide ( centuries , 0 , BigDecimal . ROUND_FLOOR ) . compareTo ( BigDecimal . ONE ) >= 0 ) { return seconds . divide ( centuries , 0 , BigDecimal . ROUND_FLOOR ) + " " + mainResource . getString ( "main.estimate.centuries" ) ; } else if ( seconds . divide ( years , 0 , BigDecimal . ROUND_FLOOR ) . compareTo ( BigDecimal . ONE ) >= 0 ) { return seconds . divide ( years , 0 , BigDecimal . ROUND_FLOOR ) + " " + mainResource . getString ( "main.estimate.years" ) ; } else if ( seconds . divide ( months , 0 , BigDecimal . ROUND_FLOOR ) . compareTo ( BigDecimal . ONE ) >= 0 ) { return seconds . divide ( months , 0 , BigDecimal . ROUND_FLOOR ) + " " + mainResource . getString ( "main.estimate.months" ) ; } else if ( seconds . divide ( days , 0 , BigDecimal . ROUND_FLOOR ) . compareTo ( BigDecimal . ONE ) >= 0 ) { return seconds . divide ( days , 0 , BigDecimal . ROUND_FLOOR ) + " " + mainResource . getString ( "main.estimate.days" ) ; } else if ( seconds . divide ( hours , 0 , BigDecimal . ROUND_FLOOR ) . compareTo ( BigDecimal . ONE ) >= 0 ) { return seconds . divide ( hours , 0 , BigDecimal . ROUND_FLOOR ) + " " + mainResource . getString ( "main.estimate.hours" ) ; } else if ( seconds . divide ( minutes , 0 , BigDecimal . ROUND_FLOOR ) . compareTo ( BigDecimal . ONE ) >= 0 ) { return seconds . divide ( minutes , 0 , BigDecimal . ROUND_FLOOR ) + " " + mainResource . getString ( "main.estimate.minutes" ) ; } else if ( seconds . compareTo ( BigDecimal . ONE ) >= 0 ) { return seconds + " " + mainResource . getString ( "main.estimate.seconds" ) ; } else { return mainResource . getString ( "main.estimate.instant" ) ; } }
Gets the estimated time to crack formatted as a string .