class VectorScalarProduct {

  public int calculateScalarProduct(Vector v1, Vector v2) {
    validateInput(v1, v2);

    int v1Size = v1.size();
    int v2Size = v2.size();
    if (v1Size != v2Size) {
      throw new IllegalArgumentException("Vectors should be contains the same number of elements.");
    }

    int result = 0;
    for (int i = 0; i < v1Size; i++) {
      result += v1.getAt(i) * v2.getAt(i);
    }
    return result;
  }

}