code: public static double dotProduct(Node[] n1, Node[] n2) {
          // logger.info("n1 " + n1.length);
          // logger.info("n2 " + n2.length);
  
          double sum = 0;
          int i = 0, j = 0;
          while (i < n1.length && j < n2.length) {
              if (n1[i] == null)
                  break;
              // logger.error("n1" + n1[i] + " " + i);
  
              if (n2[j] == null)
                  break;
              // logger.error("n2" + n2[j] + " " + j);
  
              // logger.info(n1[i].index + " == " + n2[j].index);
              if (n1[i].index == n2[j].index) {
                  // logger.info(n1[i].index + " == " + n2[j].index);
                  sum += n1[i].value * n2[j].value;
                  ++i;
                  ++j;
              } else {
                  if (n1[i].index > n2[j].index) {
                      // logger.info(n1[i].index + " > " + n2[j].index);
                      ++j;
                  } else {
                      // logger.info(n1[i].index + " <= " + n2[j].index);
                      ++i;
                  }
              }
          }
          return sum;
      }
docs: Returns an iterator over the elements in this vector in proper sequence
  (optional operation).
  
  @return an iterator over the elements in this vector in proper sequence.