Check out example codes for "formatting binary numbers in c#". It will help you in understanding the concepts better.

Code Example 1

int value = 31;
string binary = Convert.ToString(value, 2);
Console.WriteLine(binary.PadLeft(8, '0'));          // Outputs "00011111"

Learn ReactJs, React Native from akashmittal.com