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

Code Example 1

int n = 1000;
String s = Integer.toBinaryString(n);

Code Example 2

public static String makeBinaryString(int n) {
	StringBuilder sb = new StringBuilder();
	while (n > 0) {
    sb.append(n % 2);
		n /= 2;
	}
  	sb.reverse();  	
  	return sb.toString();
}

Learn ReactJs, React Native from akashmittal.com