Returns true if (current radix) + digit is a number too large to be represented by an unsigned long. This is useful for detecting overflow while parsing a string representation of a number. Does not verify whether supplied radix is valid, passing an invalid radix will give undefined results or an Ar
(long current, int digit, int radix)
| 346 | */ |
| 347 | |
| 348 | private static boolean overflowInParse(long current, int digit, int radix) { |
| 349 | if (current >= 0) { |
| 350 | if (current < maxValueDivs[radix]) { |
| 351 | return false; |
| 352 | } |
| 353 | if (current > maxValueDivs[radix]) { |
| 354 | return true; |
| 355 | } |
| 356 | // current == maxValueDivs[radix] |
| 357 | return (digit > maxValueMods[radix]); |
| 358 | } |
| 359 | |
| 360 | // current < 0: high bit is set |
| 361 | return true; |
| 362 | } |
| 363 | |
| 364 | /** |
| 365 | * Returns a string representation of x, where x is treated as unsigned. |