mercredi 3 février 2021

Java Random : How to return int value with non significative 0 [duplicate]

I need to get a random value between 0 and 100 in String format.

I use Random class, but when i cast the result in String, the non significative 0 are not kepped.

 sb.append((rand.nextInt(99)));

Is there a method in StringBuilder or Random for force the result with this 0 ?




Aucun commentaire:

Enregistrer un commentaire