Skip to content

Instantly share code, notes, and snippets.

@haran090
haran090 / IRR.java
Last active July 14, 2024 11:21
Internal Rate of Return Method (IRR)
import java.math.BigDecimal;
public class IRR {
//Approximate number of days between 2 successive cash flows. Eg. For monthly cash flows interval will be 30
private static final int INTERVAL = 30;
public static BigDecimal getAnnualIrr(double[] cash_flows) {
return calculateIrrRecursively(BigDecimal.valueOf(1.0), BigDecimal.valueOf(100.0), BigDecimal.valueOf(1.0), cash_flows);
}