Java Array Sum sumEachFigureFactor(int[] numbers)

Here you can find the source of sumEachFigureFactor(int[] numbers)

Description

sum Each Figure Factor

License

Apache License

Declaration

private static int sumEachFigureFactor(int[] numbers) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    private static final int FACTORS[] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };

    private static int sumEachFigureFactor(int[] numbers) {
        int sum = 0;
        if (FACTORS.length == numbers.length) {
            for (int i = 0; i < numbers.length; i++) {
                for (int j = 0; j < FACTORS.length; j++) {
                    if (i == j) {
                        sum = sum + numbers[i] * FACTORS[j];
                    }//from   w w w  . jav a 2s  . c  om
                }
            }
        }
        return sum;
    }
}

Related

  1. sumCoefficients(float[] array)
  2. sumdiff(double[] x)
  3. sumDigits(final long value, final int... digits)
  4. sumDoubleArray(double[] double_array)
  5. sumDoubles(Double[] ds)
  6. sumElems(boolean[] inputRow)
  7. sumFast(final double... values)
  8. sumIntArray(int[] a)
  9. sumIntArray(int[] array)