code: public double innerproduct(double[] vec1, double[] vec2) {
      double sum = 0;
  
      for (int i = 0; i < vec1.length; i++) {
        sum += vec1[i] * vec2[i];
      }
  
      return sum;
    }
docs: Calculate the dot product of two vectors