There are a number of links on this page that may help.
http://mathforum.org/dr.math/faq/faq.bases.html
Frankly, converting between radices is so elementary that we can't just give you the code for it. You have to understand what is going on underneath and then you'll write the code yourself without breaking a sweat.
Remember,
numbers don't have radix. Only
representations of numbers (the stuff we humans like to read, or the physical representation of a number) has radix.
Base 2 (binary) means two digits per power. 0 and 1.
0000 <-- 0
0001 <-- 1
0010 <-- 2 : this is essential the "ten" of binary. Hence the old joke:
"there are only 10 kinds of people: those who understand binary and those who don't".
Base 8 (octal) means eight digits per power: 0, 1, 2, 3, 4, 5, 6, and 7.
Base 10 (decimal) means ten digits per power: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
Base 16 (hexadecimal) means 16 digits per power: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F.
The difference is in the power.
123 in decimal is 1×102 + 2×101 + 3×100
123 in octal is 1× 82 + 2× 81 + 3× 80
etc.
Hope this helps.