I am currently using a random genertor to generator numbers 9 digit numbers for me. I am currently trying to use String.format, in java, to print the random numbers like this XXX-XX-XXXX which is like a social security number. I simply cant do it and i not sure how to do. I am using modulo and it seems my padding are off or i am just completely wrong. The issues is that i have to use modulo. Any assistance pointing me to the right direction is much appreciated, thank you. I am trying to fix the ID.
public String toString (){
System.out.printf("%d\n",ID);
return String.format("First Name: %12s LastName %12s ID: %03d-%02d-%04d ", firstName, lastName,ID%1000,ID%10000, ID%000001000);
}
}