src/main/java/com/se/simu/helper/StringHelper.java
@@ -1,5 +1,6 @@ package com.se.simu.helper; import java.math.BigDecimal; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -153,4 +154,13 @@ return list; } public static double setScale(double val, int scale) { BigDecimal bd = new BigDecimal(Double.toString(val)); BigDecimal roundedValue = bd.setScale(scale, BigDecimal.ROUND_HALF_UP); String str = roundedValue.toPlainString(); return Double.parseDouble(str); } }