Here you can find the source of getRoundedBigDecimal(double value)
Parameter | Description |
---|---|
value | a parameter |
public static BigDecimal getRoundedBigDecimal(double value)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; import java.math.RoundingMode; public class Main { public static final int NUMBER_DECIMAL_PLACES = 4; /**/*w w w . j a va 2 s. c o m*/ * Get a big decimal rounded out to NUMBER_DECIMAL_PLACES places * from the supplied double. * * @param value * @return */ public static BigDecimal getRoundedBigDecimal(double value) { BigDecimal bd = new BigDecimal(value); bd = bd.setScale(NUMBER_DECIMAL_PLACES, RoundingMode.HALF_UP); return bd; } }