Java tutorial
//package com.java2s; import java.math.BigDecimal; import java.math.RoundingMode; public class Main { public static float getDecreasePay(int amount, double monthRate, int totalMonth) { double v = amount / totalMonth * monthRate; return BigDecimal.valueOf(v).setScale(2, RoundingMode.HALF_UP).floatValue(); } }