Here you can find the source of dotProd(double x[], double y[])
public static double dotProd(double x[], double y[])
//package com.java2s; public class Main { public static double dotProd(double x[], double y[]) { if (x.length != y.length) throw new RuntimeException("Arrays must be same size"); double sum = 0; for (int i = 0; i < x.length; i++) sum += x[i] * y[i];/*from w ww. j a va2 s .c o m*/ return sum; } }