samples/composition/src-api2.0-compat/api/Arithmetica.java
changeset 209 1c999569643b
parent 206 b1f279a7ec46
child 210 acf2c31e22d4
     1.1 --- a/samples/composition/src-api2.0-compat/api/Arithmetica.java	Sat Jun 14 10:04:41 2008 +0200
     1.2 +++ b/samples/composition/src-api2.0-compat/api/Arithmetica.java	Sat Jun 14 10:04:51 2008 +0200
     1.3 @@ -43,10 +43,6 @@
     1.4  
     1.5      private int sumRange1(int from, int to) {
     1.6          int len = to - from;
     1.7 -        if (len < 0) {
     1.8 -            len = -len;
     1.9 -            from = to;
    1.10 -        }
    1.11          int[] array = new int[len + 1];
    1.12          for (int i = 0; i <= len; i++) {
    1.13              array[i] = from + i;
    1.14 @@ -55,7 +51,7 @@
    1.15      }
    1.16      
    1.17      private int sumRange2(int from, int to) {
    1.18 -        return (from + to) * (Math.abs(to - from) + 1) / 2;
    1.19 +        return (from + to) * (to - from + 1) / 2;
    1.20      }
    1.21  }
    1.22  // END: design.composition.arith2.0.compat