Here you can find the source of dotProduct(final double[] a, final double[] b)
public static Double dotProduct(final double[] a, final double[] b)
//package com.java2s; //License from project: Open Source License public class Main { public static Double dotProduct(final double[] a, final double[] b) { double result = 0; try {//www . j a v a2s . c o m for (int i = 0; i < a.length; i++) result += a[i] * b[i]; } catch (ArrayIndexOutOfBoundsException e) { System.err.println("Number of inputs does not match the number of weights. Exiting..."); System.exit(1); } return result; } }