Check out example codes for "java integer to binary string with leading zeros". It will help you in understanding the concepts better.

Code Example 1

int n = 1000;
String.format("%16s", Integer.toBinaryString(n).replace(' ', '0');

Learn ReactJs, React Native from akashmittal.com