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

yes4me used Ask the Experts™
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);
Watch Question

Do more with

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

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...

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...

Convert.ToInt32(string value, int fromBase)

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