Untitled


SUBMITTED BY: Guest

DATE: March 8, 2014, 2:09 p.m.

FORMAT: Text only

SIZE: 851 Bytes

HITS: 757

  1. public static String More ...toString(long i, int radix) {
  2. 116 if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
  3. 117 radix = 10;
  4. 118 if (radix == 10)
  5. 119 return toString(i);
  6. 120 char[] buf = new char[65];
  7. 121 int charPos = 64;
  8. 122 boolean negative = (i < 0);
  9. 123
  10. 124 if (!negative) {
  11. 125 i = -i;
  12. 126 }
  13. 127
  14. 128 while (i <= -radix) {
  15. 129 buf[charPos--] = Integer.digits[(int)(-(i % radix))];
  16. 130 i = i / radix;
  17. 131 }
  18. 132 buf[charPos] = Integer.digits[(int)(-i)];
  19. 133
  20. 134 if (negative) {
  21. 135 buf[--charPos] = '-';
  22. 136 }
  23. 137
  24. 138 return new String(buf, charPos, (65 - charPos));
  25. 139 }

comments powered by Disqus