Iterate over the range [ '0' , '9' ]
for ( char i = '0' ; i <= '9' ; i ++ ) { map . put ( i , i - '0' ) ; } map . put ( ' A ' , 10 ) ; map . put ( ' B ' , 11 ) ; map . put ( ' C ' , 12 ) ; map . put ( ' D ' , 13 ) ; map . put ( ' E ' , 14 ) ; map . put ( ' F ' , 15 ) ;