Java BigDecimal Format formatDoubleValue(int medianAfterTheDecimalPoint, String doubleStringValue)

Here you can find the source of formatDoubleValue(int medianAfterTheDecimalPoint, String doubleStringValue)

Description

format Double Value

License

Apache License

Declaration

public static double formatDoubleValue(int medianAfterTheDecimalPoint, String doubleStringValue) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;

public class Main {
    public static double formatDoubleValue(int medianAfterTheDecimalPoint, String doubleStringValue) {
        Double doubleValue = Double.valueOf(doubleStringValue);
        return new BigDecimal(doubleValue.doubleValue())
                .setScale(medianAfterTheDecimalPoint, BigDecimal.ROUND_HALF_UP).doubleValue();
    }//  w w  w  .  ja v  a2  s. co  m
}

Related

  1. formatDouble(double d)
  2. formatDouble(Double someDouble, int digitsToTheRightOfDecimal)
  3. formatDouble(Double toFormat)
  4. formatDouble(double value, int decimalPlaces)
  5. formatDoubleNumber(double f)
  6. formate(BigDecimal amount)
  7. formatFAAssertRatioWithoutPercent(BigDecimal value)
  8. formatFileSize(double size)
  9. formatFloat0(String value, int n)