Check out example codes for "int to binary string with 4 characters". It will help you in understanding the concepts better.

Code Example 1

Convert.ToString(3, 2).PadLeft(4, '0') // 0011
Convert.ToString(3, 2).PadLeft(8, '0') // 00000011

Learn ReactJs, React Native from akashmittal.com