1 package org.apidesign.math;
3 /** Class to simplify arithmetical operations, improved version to compute
6 * @author Jaroslav Tulach <jtulach@netbeans.org>
9 public class Arithmetica {
10 public int sumTwo(int one, int second) {
14 public int sumAll(int... numbers) {
15 if (numbers.length == 0) {
19 for (int i = 1; i < numbers.length; i++) {
20 sum = sumTwo(sum, numbers[i]);
25 // BEGIN: design.composition.arith2.0
26 public int sumRange(int from, int to) {
27 return (from + to) * (Math.abs(to - from) + 1) / 2;
29 // END: design.composition.arith2.0