Class MoneyUtils

java.lang.Object
org.episteme.social.economics.money.MoneyUtils

public final class MoneyUtils extends Object
Utility class for financial calculations using high-precision Real numbers.

Provides methods for computing interest rates, loan payments, and other financial formulas.

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
See Also:
  • Method Details

    • simpleInterestFutureValue

      public static Real simpleInterestFutureValue(Real principal, Real interestRate, int numberOfPeriods)
      Calculates the future value with simple interest.
      Parameters:
      principal - initial deposit
      interestRate - annual interest rate (as decimal, e.g., 0.05 for 5%)
      numberOfPeriods - number of periods
      Returns:
      the future value
    • simpleInterestPresentValue

      public static Real simpleInterestPresentValue(Real futureValue, Real interestRate, int numberOfPeriods)
      Calculates the present value for simple interest.
      Parameters:
      futureValue - the target future value
      interestRate - annual interest rate
      numberOfPeriods - number of periods
      Returns:
      the present value (initial deposit needed)
    • simpleInterestRate

      public static Real simpleInterestRate(Real principal, Real futureValue, int numberOfPeriods)
      Calculates the interest rate from initial and final values.
      Parameters:
      principal - initial deposit
      futureValue - final value
      numberOfPeriods - number of periods
      Returns:
      the annual interest rate
    • simpleInterestPeriods

      public static Real simpleInterestPeriods(Real principal, Real futureValue, Real interestRate)
      Calculates the number of periods needed to reach a target.
      Parameters:
      principal - initial deposit
      futureValue - target value
      interestRate - annual interest rate
      Returns:
      the number of periods
    • compoundInterestFutureValue

      public static Real compoundInterestFutureValue(Real principal, Real interestRate, int compoundsPerYear, int numberOfYears)
      Calculates the future value with compound interest.
      Parameters:
      principal - initial deposit
      interestRate - annual interest rate
      compoundsPerYear - number of compounding periods per year
      numberOfYears - number of years
      Returns:
      the future value
    • continuousInterestFutureValue

      public static Real continuousInterestFutureValue(Real principal, Real interestRate, int numberOfYears)
      Calculates future value with continuous compounding.
      Parameters:
      principal - initial deposit
      interestRate - annual interest rate
      numberOfYears - number of years
      Returns:
      the future value
    • effectiveAnnualRate

      public static Real effectiveAnnualRate(Real nominalRate, int compoundsPerYear)
      Calculates the effective annual rate (EAR).
      Parameters:
      nominalRate - the nominal annual rate
      compoundsPerYear - number of compounding periods
      Returns:
      the effective annual rate
    • loanPrincipal

      public static Real loanPrincipal(Real paymentPerPeriod, Real interestRate, int numberOfPeriods)
      Calculates the maximum loan amount for given payment.
      Parameters:
      paymentPerPeriod - the periodic payment
      interestRate - periodic interest rate
      numberOfPeriods - total number of payments
      Returns:
      the maximum loan amount
    • loanPayment

      public static Real loanPayment(Real principal, Real interestRate, int numberOfPeriods)
      Calculates the periodic payment for a loan.
      Parameters:
      principal - loan amount
      interestRate - periodic interest rate
      numberOfPeriods - total number of payments
      Returns:
      the periodic payment
    • loanBalance

      public static Real loanBalance(Real principal, Real annualRate, int paymentsPerYear, int yearsPaid, Real paymentAmount)
      Calculates the remaining balance on a loan.
      Parameters:
      principal - original loan amount
      annualRate - annual percentage rate
      paymentsPerYear - payments per year
      yearsPaid - years of payments made
      paymentAmount - amount of each payment
      Returns:
      the remaining balance
    • totalInterestPaid

      public static Real totalInterestPaid(Real principal, Real payment, int numberOfPeriods)
      Calculates total interest paid over the life of a loan.
      Parameters:
      principal - loan amount
      payment - periodic payment
      numberOfPeriods - total number of payments
      Returns:
      the total interest paid
    • compoundInterest

      public static Money compoundInterest(Money principal, Real interestRate, int compoundsPerYear, int years)
      Applies compound interest to a money amount.
      Parameters:
      principal - the initial amount
      interestRate - annual interest rate
      compoundsPerYear - compounding frequency
      years - number of years
      Returns:
      the future value
    • monthlyMortgagePayment

      public static Money monthlyMortgagePayment(Money principal, Real annualRate, int years)
      Calculates monthly mortgage payment.
      Parameters:
      principal - loan amount
      annualRate - annual interest rate
      years - loan term in years
      Returns:
      the monthly payment