Class FinanceLib


  • public final class FinanceLib
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double fv​(double r, double n, double y, double p, boolean t)
      Future value of an amount given the number of payments, rate, amount of individual payment, present value and boolean value indicating whether payments are due at the beginning of period (false => payments are due at end of period)
      static double nper​(double r, double y, double p, double f, boolean t)  
      static double npv​(double r, double[] cfs)
      calculates the Net Present Value of a principal amount given the discount rate and a sequence of cash flows (supplied as an array).
      static double pmt​(double r, double n, double p, double f, boolean t)  
      static double pv​(double r, double n, double y, double f, boolean t)
      Present value of an amount given the number of future payments, rate, amount of individual payment, future value and boolean value indicating whether payments are due at the beginning of period (false => payments are due at end of period)
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • fv

        public static double fv​(double r,
                                double n,
                                double y,
                                double p,
                                boolean t)
        Future value of an amount given the number of payments, rate, amount of individual payment, present value and boolean value indicating whether payments are due at the beginning of period (false => payments are due at end of period)
        Parameters:
        r - rate
        n - num of periods
        y - pmt per period
        p - future value
        t - type (true=pmt at end of period, false=pmt at begining of period)
      • pv

        public static double pv​(double r,
                                double n,
                                double y,
                                double f,
                                boolean t)
        Present value of an amount given the number of future payments, rate, amount of individual payment, future value and boolean value indicating whether payments are due at the beginning of period (false => payments are due at end of period)
        Parameters:
        r -
        n -
        y -
        f -
        t -
      • npv

        public static double npv​(double r,
                                 double[] cfs)
        calculates the Net Present Value of a principal amount given the discount rate and a sequence of cash flows (supplied as an array). If the amounts are income the value should be positive, else if they are payments and not income, the value should be negative.
        Parameters:
        r -
        cfs - cashflow amounts
      • pmt

        public static double pmt​(double r,
                                 double n,
                                 double p,
                                 double f,
                                 boolean t)
        Parameters:
        r -
        n -
        p -
        f -
        t -
      • nper

        public static double nper​(double r,
                                  double y,
                                  double p,
                                  double f,
                                  boolean t)
        Parameters:
        r -
        y -
        p -
        f -
        t -