@ IntRange ( from = 1000 , to = 9999 ) static int convertTwoDigitYearToFour ( @ IntRange ( from = 0 , to = 99 ) int inputYear ) { return convertTwoDigitYearToFour ( inputYear , Calendar . getInstance ( ) ) ; }
Converts a two - digit input year to a four - digit year . As the current calendar year approaches a century we assume small values to mean the next century . For instance if the current year is 2090 and the input value is 18 the user probably means 2118 not 2018 . However in 2017 the input 18 probably means 2018 . This code should be updated before the year 9981 .