Hier eine nicht von mir entwickelte Methode zur errechnung des Zineszins. Da ich der meinung bin, dass dies eine sehr nützliche und sauber Programmierte Methode ist, möchte ich sie euch nicht vorenthalten. Vielen Dank an das Java CodeBook für diesen Artikel. Folgendes Beispiel demonistriert die Kaltulation des Zineszins:

/*
 * Beispiele erstellt von Emanuel Seibold
 * Quelle EBooks, Tutorials
 */
package tutorialzahlen;
 
public class Main {
 
    public static void main(String[] args) {
 
    }
 
    /**
     * Kapitalentwicklung bei monatlicher Ratenzahlung und Zinseszins
     */
    public static double capitalWithCompoundInterest(double startCapital, double installment, double interest, int term) {
        if (interest == 0.0) {
            throw new IllegalArgumentException("Zins darf nicht Null sein");
        }
 
        double interestRate = interest / 100.0;
        double accumulationFactor = 1 + interestRate;
        double endCapital = startCapital * Math.pow(accumulationFactor, term) + installment * (Math.pow(accumulationFactor, term) - 1) / (Math.pow(accumulationFactor, 1 / 12.0) - 1) * Math.pow(accumulationFactor, 1 / 12.0);
        return endCapital;
    }
 
    /**
     * Berechnung des eingezahlten Kapitals
     */
    public static double paidInCapital(double startCapital, double installment, int term) {
        double endCapital = startCapital;
        for (int n = 1; n <= term; ++n) {
            endCapital = endCapital + 12 * installment;
        }
        return endCapital;
    }
}