Java tutorial
//package com.java2s; import java.math.BigDecimal; import java.math.RoundingMode; public class Main { public static double Rounding(double d) { BigDecimal bd = new BigDecimal(d); bd.setScale(1, RoundingMode.HALF_UP); return bd.floatValue(); } }