@ Override public String format ( int index ) { StringBuilder sb = new StringBuilder ( ) ; final RomanNumeral [ ] values = RomanNumeral . values ( ) ; for ( int i = values . length - 1 ; i >= 0 ; i -- ) { while ( index >= values [ i ] . weight ) { sb . append ( values [ i ] ) ; index -= values [ i ] . weight ; } } return sb . toString ( ) ; }
Format index as upper case Roman numeral .