code: public static PrimitiveMatrix toCovariances(Access1D<?> volatilities, Access2D<?> correlations) {
  
          int tmpSize = (int) volatilities.count();
  
          PrimitiveMatrix.DenseReceiver retVal = PrimitiveMatrix.FACTORY.makeDense(tmpSize, tmpSize);
  
          for (int j = 0; j < tmpSize; j++) {
              double tmpColumnVolatility = volatilities.doubleValue(j);
              retVal.set(j, j, tmpColumnVolatility * tmpColumnVolatility);
              for (int i = j + 1; i < tmpSize; i++) {
                  double tmpCovariance = volatilities.doubleValue(i) * correlations.doubleValue(i, j) * tmpColumnVolatility;
                  retVal.set(i, j, tmpCovariance);
                  retVal.set(j, i, tmpCovariance);
              }
          }
  
          return retVal.get();
      }
docs: Vill constract a covariance matrix from the standard deviations (volatilities) and correlation
  coefficient,