java integer to binary string with leading zeros

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

Also in Java: