I want to format 4-digit numbers with left padded zeros and 5-digit numbers with no leading zeros so when e.g:
- I insert 124 it is formatted to 0124.
- 30 is formatted to 0030.
- When number >9999 then it has no zero padding.
I tried String.format("%05d", Integer.parseInt(something));
but when I format 124, I get 00124