Hi
What do you mean by a 12 bit hexadecimal number? Can you post examples with the problem you have?
A 12 bit hexadecimal number has only 3 digits (it could have 4 if it were decimal) and so I don't see the problem.
It would also help if you'd explain the context. What do you need this for?