Took like ten minutes to find the right thing in the docs. But finally.
int randomNumber = randomGenerator.nextInt(9999);
System.out.println(String.format("%04d", randomNumber));
2213
0060
8492
8872
0064
5808
1552
0458
7856
8925
int randomNumber = randomGenerator.nextInt(9999);
System.out.println(String.format("%04d", randomNumber));