java string format method
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.
int totalNumberOfCars = 122; String s = String.format("%02d",
(totalNumberOfCars + 1)
No comments:
Post a Comment