Here you can find the source of dotProd(double[] a, double[] b)
public static double dotProd(double[] a, double[] b)
//package com.java2s; public class Main { public static double dotProd(double[] a, double[] b) { if (a.length != b.length) { throw new IllegalArgumentException( "The dimensions have to be equal!"); }//from w ww.j ava 2 s . c om double sum = 0; for (int i = 0; i < a.length; i++) { sum += a[i] * b[i]; } return sum; } }