Java Decimal Format getDigitNumber(double p)

Here you can find the source of getDigitNumber(double p)

Description

get Digit Number

License

Open Source License

Declaration

public static int getDigitNumber(double p) 

Method Source Code

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

import java.text.DecimalFormat;
import java.text.NumberFormat;

public class Main {
    public static int getDigitNumber(double p) {
        NumberFormat formatter = new DecimalFormat();
        formatter = new DecimalFormat("0.######E0");
        String s = formatter.format(p);
        //        String s = p + "";
        //        return s.length();
        String ss = s.substring(s.indexOf("E") + 1);
        return Integer.parseInt(ss);
    }//  w w w .  jav  a 2s.co  m
}

Related

  1. getDecimalFormatSymbols( Locale locale)
  2. getDecimalFormatSymbols(final Locale locale)
  3. getDecimalFormattedNoQuote(String englishFormat)
  4. getDecimalFormatter()
  5. getDecimalFormatter(int scale)
  6. getDoubleAsString(double value)
  7. getDoubleByNumeric(String valorTexto)
  8. getDoubleDecimalNumber(double d)
  9. getDoubledigit(double f)