I have a very small number and I want to convert it to a String with the full number, not abbreviated in any way. I don't know how small this number can be.
for example, when I run:
double d = 1E-10;
System.out.println(d);
it shows 1.0E-10
instead of 0.000000001.
I've already tried NumberFormat.getNumberInstance()
but it formats to 0
. and I don't know what expression to use on a DecimalFormat
to work with any number.
Assuming that you want 500 zeroes in front of your number when you do:
double d = 1E-500;
then you can use:
double d = 1E-10;
NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(Integer.MAX_VALUE);
System.out.println(nf.format(d));
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments