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);
}
@haran090
haran090 / XMLSigner.java
Last active October 7, 2017 10:26
XML Signature demo application for TRAI
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.security.InvalidAlgorithmParameterException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableEntryException;