for example, for 1, 2, 128, 256 the output can be (16 digits):
1, 2, 128, 256
0000000000000001 0000000000000010 0000000010000000 0000000100000000
You can use Apache Commons StringUtils. It offers methods for padding strings:
StringUtils.leftPad(Integer.toBinaryString(1), 16, '0');