Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static final char[] digits = {'0','1','2','3','4','5','6','7','8','9'};
- ...
- public void func(int toConvert){
- ...
- int max = 1000000000;
- countLen = 0;
- boolean significant = false;
- while(max > 0)
- {
- final int thisDigit = toConvert/ max;
- if(!significant && thisDigit == 0)
- {
- max /= 10;
- continue;
- }
- significant = true;
- count[countLen++] = digits[thisDigit];
- toConvert -= thisDigit * max;
- max /= 10;
- }
- count[countLen] = 0;
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement