Any number can be formatted into 15 decimal digits when presented as a string. This is achieved when the number is converted to a String, e.g.:
System.out.println(String.format("%015d", 1));
// prints: 000000000000001
If you want to generate a random number that lies between 100,000,000,000,000
and 999,999,999,999,999
then you can perform a trick such as:
Random random = new Random();
long n = (long) (100000000000000L + random.nextFloat() * 900000000000000L);
If your ultimate goal is to have a 15-character string containing random decimal digits, and you're happy with third-party libraries, consider Apache commons RandomStringUtils
:
boolean useLetters = false;
boolean useNumbers = true;
int stringLength = 15;
String result = RandomStringUtils.random(stringLength, useLetters, useNumbers)