1 Reply Latest reply: Jan 31, 2007 5:37 AM by 800435 RSS

    Double numbers

    807607
      Hi,

      I have the following double number:

      130.12756

      I want to round it to: 130.123

      Is there any methods under Math class that can help
        • 1. Re: Double numbers
          800435
          Check out Decimal Format class

          http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html

          Something like this:
          System.out.println(new DecimalFormat("0.000").format(130.12756))