public static double npv(double r, double[] cfs) {double npv = 0;double r1 = r + 1;double trate = r1;for (int i=0, iSize=cfs.length; i<iSize; i++) {npv += cfs[i] / trate;trate *= r1;}return npv;}

public static double npv(double r, double[] cfs){double npv = 0;double r1 = r + 1;double trate = r1;for (int i = 0, iSize = cfs.Length; i < iSize; i++){npv += cfs[i] / trate;trate *= r1;}return npv;}
