Divide it by 16 to get the number of that character in it. then do a mod 16 on it to grab the remainder. Divide the remainder by 8. Then mod by 8. Divide by 4, then mod by 4 and so on. It is really a simple problem.