Java BigDecimal Format formatDigit(double value, int scale)

Here you can find the source of formatDigit(double value, int scale)

Description

format Digit

License

Open Source License

Declaration

public static double formatDigit(double value, int scale) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.math.BigDecimal;

public class Main {

    public static double formatDigit(double value, int scale) {
        BigDecimal bd = new BigDecimal(value);
        bd = bd.setScale(scale, BigDecimal.ROUND_HALF_UP);
        double d = bd.doubleValue();
        bd = null;/*from   www.  j a  v a 2s .co  m*/
        return d;
    }
}

Related

  1. formatCUBRIDNumber(BigDecimal value)
  2. formatDecimal(BigDecimal b)
  3. formatDecimal(BigDecimal num)
  4. formatDecimal(BigDecimal number, int maxFractionDigits, int minFractionDigits)
  5. formatDecimalCost(BigDecimal value)
  6. formatDouble(double d)
  7. formatDouble(Double someDouble, int digitsToTheRightOfDecimal)
  8. formatDouble(Double toFormat)
  9. formatDouble(double value, int decimalPlaces)