Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!

Hex, Octal conversion

John Anderson
Greenhorn
Posts: 3
Hello everyone, I am taking the text Tuesday...
I can not find any info on how to convert a decimal to an Octal or Hex. I understand how to convert an Octal or Hex to decimal.
Could someone shed some light on this for me?
Thanks!

Neelima Rao
Greenhorn
Posts: 26

Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
shrink182,
I'd like you to read the Javaranch Naming Policy and change your publicly displayed name to comply with our unique rule. Thank you.
[ April 12, 2002: Message edited by: Valentin Crettaz ]

Suman Dass
Greenhorn
Posts: 28
pl search the web or look into any standard math book. best of luck for the exams!!!

vinita Kh
Ranch Hand
Posts: 49
a short cut way to convert decimal to Hex or Oct
lets convert decimal 300 to Hex ---
300/16 result->18 Rest ->12 write rest in Hex -> C
18/16 result->1 Rest ->2 Write rest in Hex -> 2
1/16 result ->0 Rest ->1 Write rest in Hex -> 1
resverse hex digits thus obtained ie ->12C
hence
300(decimal) = 12C (Hex)
similarly replace 16 with 8 to convert to octal
Cheers..
Vinita

John Anderson
Greenhorn
Posts: 3
Thanks for the help guys, that info should do the trick. Thanks