This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
You basically divide the number successively by 16 until you get a remainder that is less than 16. That is, for the number 20 for example: 20/16 you have 1 rem 4. So your number 20 in hex will be 14, and in hava hex notation that will be 0x14. for the number 40 you have: 40/16 2 rem 8 and becomes 0x28 I hope this helps.