4 Replies Latest reply: Feb 15, 2008 4:49 PM by 807603 RSS

    problem with bigdecimal conversion


      I want to convert the double number 25000000 to BigDecimal, but the result that I get is 2.5E+7 and this number causes that the application throws an exception.

      I'm doing it this way:

      double number=25000000;          
      String value = Double.toString(number);          
      BigDecimal bd = new BigDecimal(value);

      The funny thing is that if I try with 25000000.12 it works fine... I tried to get the long value of the BigDecimal and that works for the 25000000 but no for 25000000.12, because I get no decimals...

      Any idea of how can I get this to work?

      Thanks in advance