Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.security.InvalidParameterException;

public class Main {
    private static double averageMult(double[] mass1, double[] mass2) throws InvalidParameterException {
        if (mass1.length != mass2.length)
            throw new InvalidParameterException("mass1.length != mass2.length");
        if (0 == mass1.length)
            return 0;
        double sum = 0;

        for (int i = 0; i < mass1.length; i++)
            sum += mass1[i] * mass2[i];
        return sum / mass1.length;
    }
}