Java BigDecimal Format formatDouble(Double toFormat)

Here you can find the source of formatDouble(Double toFormat)

Description

format Double

License

Open Source License

Declaration

public static BigDecimal formatDouble(Double toFormat) 

Method Source Code


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

import java.math.BigDecimal;
import java.math.RoundingMode;

public class Main {
    private static final Integer SCALE = 2;

    public static BigDecimal formatDouble(Double toFormat) {
        BigDecimal currency = new BigDecimal(toFormat);

        return currency.setScale(SCALE, RoundingMode.DOWN);
    }/* w ww  . j  a  v a 2 s.  c om*/
}

Related

  1. formatDecimal(BigDecimal number, int maxFractionDigits, int minFractionDigits)
  2. formatDecimalCost(BigDecimal value)
  3. formatDigit(double value, int scale)
  4. formatDouble(double d)
  5. formatDouble(Double someDouble, int digitsToTheRightOfDecimal)
  6. formatDouble(double value, int decimalPlaces)
  7. formatDoubleNumber(double f)
  8. formatDoubleValue(int medianAfterTheDecimalPoint, String doubleStringValue)
  9. formate(BigDecimal amount)