Here you can find the source of roundHalfUp2Scale(BigDecimal value)
public static Double roundHalfUp2Scale(BigDecimal value)
//package com.java2s; import java.math.BigDecimal; public class Main { public static Double roundHalfUp2Scale(BigDecimal value) { if (value == null) return null; BigDecimal bd = value.setScale(2, BigDecimal.ROUND_HALF_UP); return bd.doubleValue(); }//from ww w.ja va 2 s . c o m public static BigDecimal roundHalfUp2Scale(Double value) { if (value == null) return null; String sval = String.valueOf(value); BigDecimal bd = new BigDecimal(sval); return bd.setScale(2, BigDecimal.ROUND_HALF_UP); } }