bit representation of a number

  • Thread starter Thread starter William Stacey [MVP]
  • Start date Start date
W

William Stacey [MVP]

int i = 4390;
string base2String = Convert.ToString(i, 2);
Console.WriteLine(base2String);

or use a hashtable.
 
Is there way to convert an int or byte into a string representation of its
bits. For example, an int with a value of 7 would be displayed as "0111".

Thanks for helping.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top