()
| 577 | |
| 578 | |
| 579 | public int sum() { |
| 580 | long amount = sumLong(); |
| 581 | if (amount > Integer.MAX_VALUE) { |
| 582 | throw new RuntimeException("sum() exceeds " + Integer.MAX_VALUE + ", use sumLong()"); |
| 583 | } |
| 584 | if (amount < Integer.MIN_VALUE) { |
| 585 | throw new RuntimeException("sum() less than " + Integer.MIN_VALUE + ", use sumLong()"); |
| 586 | } |
| 587 | return (int) amount; |
| 588 | } |
| 589 | |
| 590 | |
| 591 | public long sumLong() { |