Converting from Base 10 to Base 2


Usually the base ten number is entered into a text field and is represented as a string of characters.
Each string character is then moved to a struct for a base 10 number.
Regroup the digits into a string of 6 digits and convert them to a long integer.
Convert this array of long to base 256. 256 is a base that is a power of 2 and the divide procedures for changing base is sped up by using a larger base.
The base 256 remainders are placed in an array becoming the base 256 number.
An array with the known binary strings for each number between 0 to 255 is used to convert base 256 to base 2.
0256 = 000000002, 255256 = 111111112


Last updated: 4/18/2002
Webmaster: Ulrich (Ulie) Sondermann usondermann@earthlink.net
© copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002