Java BigDecimal Format formatDoubleNumber(double f)

Here you can find the source of formatDoubleNumber(double f)

Description

format Double Number

License

Open Source License

Declaration

public static double formatDoubleNumber(double f) 

Method Source Code


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

import java.math.BigDecimal;

public class Main {
    public static double formatDoubleNumber(double f) {
        BigDecimal b = new BigDecimal(f);
        return b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
    }//from   w ww  . j  a  v  a 2s  .c  om
}

Related

  1. formatDigit(double value, int scale)
  2. formatDouble(double d)
  3. formatDouble(Double someDouble, int digitsToTheRightOfDecimal)
  4. formatDouble(Double toFormat)
  5. formatDouble(double value, int decimalPlaces)
  6. formatDoubleValue(int medianAfterTheDecimalPoint, String doubleStringValue)
  7. formate(BigDecimal amount)
  8. formatFAAssertRatioWithoutPercent(BigDecimal value)
  9. formatFileSize(double size)