Java tutorial
//package com.java2s; import java.math.BigDecimal; public class Main { public static Double getDoubleFromDoubletRoundHalfUp1(double sourceNum, int scale) { BigDecimal bigDecimal = new BigDecimal(sourceNum); return bigDecimal.setScale(scale, BigDecimal.ROUND_HALF_UP).doubleValue(); } }