tracks/java/exercises/sum-of-multiples/src/example/java/SumOfMultiples.java in trackler-2.1.0.13 vs tracks/java/exercises/sum-of-multiples/src/example/java/SumOfMultiples.java in trackler-2.1.0.14

- old
+ new

@@ -1,34 +1,34 @@ -public class SumOfMultiples { - private final int sum; - - public SumOfMultiples(int number, int[] set) { - sum = calculateSum(number, set); - } - - public int getSum() { - return sum; - } - - private int calculateSum(int number, int[] set) { - - int sum = 0; - int count = 0; - - for (int i = 1; i < number; i++) { - - for (int j = 0; j < set.length; j++) { - if (i % set[j] == 0) { - count++; - } - } - - if (count > 0) { - sum = sum + i; - count = 0; - } - } - - return sum; - } - -} +public class SumOfMultiples { + private final int sum; + + public SumOfMultiples(int number, int[] set) { + sum = calculateSum(number, set); + } + + public int getSum() { + return sum; + } + + private int calculateSum(int number, int[] set) { + + int sum = 0; + int count = 0; + + for (int i = 1; i < number; i++) { + + for (int j = 0; j < set.length; j++) { + if (i % set[j] == 0) { + count++; + } + } + + if (count > 0) { + sum = sum + i; + count = 0; + } + } + + return sum; + } + +}