()
| 551 | |
| 552 | |
| 553 | public int sum() { |
| 554 | long amount = sumLong(); |
| 555 | if (amount > Integer.MAX_VALUE) { |
| 556 | throw new RuntimeException("sum() exceeds " + Integer.MAX_VALUE + ", use sumLong()"); |
| 557 | } |
| 558 | if (amount < Integer.MIN_VALUE) { |
| 559 | throw new RuntimeException("sum() less than " + Integer.MIN_VALUE + ", use sumLong()"); |
| 560 | } |
| 561 | return (int) amount; |
| 562 | } |
| 563 | |
| 564 | |
| 565 | public long sumLong() { |