Conversion from decimal to hexadecimal(base 16) to Octadecimal(Base 8)

yes4me
yes4me used Ask the Experts™
on
To make a short story, how do you convert a base n number to some base m number?

For example, here is how you do in Java from base 10 to 8:
String tmpOCT = Integer.toString(tmpValue , 8);
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Conversions to hex is quite similar:

String tmpHex = tmpValue.ToString("X")

Don't know about octal though.

Jaco Conroy
To convert a 32-bit signed integer value to its equivalent String representation in a specified base use...

(C#)
Convert.ToString(int value, int toBase)

To convert a string representation of a number in a specified base to an equivalent 32-bit signed integer use...

(C#)
Convert.ToInt32(string value, int fromBase)

NOTE:
These methods only support the bases 2, 8, 10, or 16.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial