What I want to do is getting the first 2 digits of a number. If number hasn't digits more than 1 then It will add leading zeros.
s variable equals to "122" but I want to get first 2 digits which are "12". I think there is a problem with my format.
for example if totalNumberOfCars equals 6 then s variable will equals to "06".
int totalNumberOfCars = 122;
String s = String.format("%02d", (totalNumberOfCars + 1))
EDIT: Is there anyone knows what String.format("%02d", totalNumberOfCars) does?