Are you asking how to write a function that converts a number like 4002 from base-10 to base-16? Sounds like a first-quarter programming class assignment to me.
You'd need to read the input number into a binary format (Integer, for example).
You'd need to break your input data up into 4-bit chunks.
__You'd need to write a routine that converts a 4-bit chunk into a character in the set (0..9, A..F).
____if the value of the 4-bit chunk was less than 10, you'd do one conversion (to 0..9), otherwise you'd do a different conversion (to A..F).
You'd need to correctly assemble the returned characters.
You'd need to write the output.
And, you'd probably want to ask this question in the Software forum, unless I completely misunderstood your request.
/frank