Blog Archive for August 1, 2013

Don't Use double Constructor on BigDecimal

August 1, 2013

Avoid using the BigDecimal constructor in Java that takes a double:

public class Test
{
  public static void main(String[] argv)
  {
    double lDouble = 123.45;
    System.out.println(lDouble);
    BigDecimal lDoubleBigDecimal = new BigDecimal(lDouble);
    System.out. …