function toHexString(num) {
    var str = num.toString(16);

    while (str.length < 2) {
        str = '0' + str;
    }

    return str;
}
function toHexString(num) {
    var str = num.toString(16);

    while (str.length < 2) {
        str = '0' + str;
    }

    return str;
}
function toHexString ( num ) { var str = num . toString ( 16 ) ; while ( str . length < 2 ) { str = '0' + str ; } return str ; }
Converts from a number like 15 to a hex string like 'F'
@param {number} num
@returns {string}
Converts from a number like 15 to a hex string like F