Advertisement
Guest User

Untitled

a guest
May 15th, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. private static final char[] digits = {'0','1','2','3','4','5','6','7','8','9'};
  2.  
  3. ...
  4.  
  5. public void func(int toConvert){
  6.  
  7. ...
  8.  
  9. int max = 1000000000;
  10. countLen = 0;
  11. boolean significant = false;
  12. while(max > 0)
  13. {
  14. final int thisDigit = toConvert/ max;
  15. if(!significant && thisDigit == 0)
  16. {
  17. max /= 10;
  18. continue;
  19. }
  20. significant = true;
  21. count[countLen++] = digits[thisDigit];
  22. toConvert -= thisDigit * max;
  23. max /= 10;
  24. }
  25. count[countLen] = 0;
  26. ...
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement