Here is an example of some code I wrote using "DecimalFormat" that does
what your looking for. I am new to Java myself and if you are too I am sure
the example may help. Good luck!

          DecimalFormat twoDigits = new DecimalFormat("0.00");

          result = (10  / 3);
          return Double.parseDouble(twoDigits.format(result));






Nandish Angadi <[EMAIL PROTECTED]>@JAVA.SUN.COM> on 01/01/2002
10:45:00 PM

Please respond to "A mailing list for discussion about Sun Microsystem's
      Java               Servlet API Technology."
      <[EMAIL PROTECTED]>

Sent by:  "A mailing list for discussion about Sun Microsystem's Java
      Servlet API Technology." <[EMAIL PROTECTED]>


To:   [EMAIL PROTECTED]
cc:

Subject:  need help


hi all,
        How can i display the the calculated value with two decimals.i.e.
10/3=3.333333333333.....but i want to display 3.33. May be this is the
wrong fourm, Sorry for it
Thanks for all

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to