Function to convert Decimal to Hex
function convertToHex ( num ) { let temp = " " ; while ( num != 0 ) { let rem = num % 16 ; let c = 0 ; if ( rem < 10 ) { c = rem + 48 ; } else { c = rem + 87 ; } temp += String . fromCharCode ( c ) ; num = Math . floor ( num / 16 ) ; } return temp ; }