View Single Post
  #2 (permalink)  
Old 01-29-2008, 07:00 AM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Age: 26
Posts: 5,980
Last Blog:
SAP, ERP and EDI
Rep Power: 20
Jordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud of
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default

Decimal to binary is a simple enough equation that you can create it yourself. Divide your decimal number by 2 and take the remainder. You can do this using the modulus (%) operator. Keep doing this until the decimal number = 0.

Code:
(int) BinaryMod = decimalNumber %2;
(String) BinaryDisplay += BinaryMod;
decimalNumber / 2;
In .NET you can use:

Code:
 Convert.ToString(DecimalValue, 2).PadLeft(8, "0")
Where DecimalValue is your decimal number and 2 is your base. Using that function you can convert to any base.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
Don't hesitate to ask any questions that you have! Check out our ASCII Calculator!
Reply With Quote