Wednesday, December 24, 2008

Double to String without scientific notation

import java.math.BigDecimal;

public class DoubleToString
{
public static void main(String[] args)
{
double value = 1111111111;
System.out.println(value);
BigDecimal bigDecimal = new BigDecimal(value);
//Returns a string representation of this double without an exponent field
System.out.println(bigDecimal.toPlainString());
}
}

1 comment:

  1. Thanks for this solution. I was troubled with this issue for ages.

    ReplyDelete