Android examples for java.lang:Math
round double value by scale and rounding mode
//package com.java2s; import java.math.BigDecimal; public class Main { public static double round(double value, int scale, int roundingMode) { BigDecimal bd = new BigDecimal(value); bd = bd.setScale(scale, roundingMode); double d = bd.doubleValue(); bd = null;//from w ww. j ava 2 s. c o m return d; } }