map for decimal to hexa , 0 - 9 are straightforward , alphabets a - f used for 10 to 15.
HashMap < Integer , Character > m = new HashMap < Integer , Character > ( ) ; char digit = '0' ; char c = ' a ' ; for ( int i = 0 ; i <= 15 ; i ++ ) { if ( i < 10 ) { m . put ( i , digit ) ; digit ++ ; } else { m . put ( i , c ) ; c ++ ; } }