Example: Depreciation - Fixed Declining Balance Method

The depreciation of an asset with an initial cost of $2500 and a salvage value of $500 over a period of 3 years is calculated. Here month is 6 since the life of the asset did not begin until the seventh month of the first year.
import com.imsl.finance.*;
import java.text.NumberFormat;

public class dbEx1 {
    public static void main(String args[]) {
        double cost = 2500;
        double salvage = 500;
        int life = 3;
        int month = 6;
        
        for (int period = 1;  period <= life+1;  period++) {
            double db = Finance.db(cost, salvage, life, period, month);
            System.out.println("For period "+period+"    db = " +
            NumberFormat.getCurrencyInstance().format(db));
        }
    }
}

Output

For period 1    db = $518.75
For period 2    db = $822.22
For period 3    db = $481.00
For period 4    db = $140.69
Link to Java source.