Java Decimal Format getDoubledigit(double f)

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

Description

get Doubledigit

License

Open Source License

Declaration

public static double getDoubledigit(double f) 

Method Source Code

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

import java.text.DecimalFormat;

public class Main {

    public static double getDoubledigit(double f) {
        DecimalFormat df = new DecimalFormat("#####.00");
        return Double.parseDouble(df.format(f));
    }//from   ww w  .  ja va 2  s .  c o  m

    public static Double parseDouble(String str) {
        try {
            DecimalFormat df = new DecimalFormat("#,##0.0#");
            return Double.valueOf(String.valueOf(df.parseObject(str)));
        } catch (Exception e) {
            return new Double(0.0);
        }
    }
}

Related

  1. getDecimalFormatter(int scale)
  2. getDigitNumber(double p)
  3. getDoubleAsString(double value)
  4. getDoubleByNumeric(String valorTexto)
  5. getDoubleDecimalNumber(double d)
  6. getDoubleForDisplay(Double d)
  7. getDoubleFromTaxSet(String taxSetValue)
  8. getDoubleWithTwoDecimalDigits(double value)
  9. getDurationString(double duration)