Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

commas with decimals in amounts

Posted on 2007-10-04
2
Medium Priority
?
179 Views
Last Modified: 2010-03-30
                 String x="24668124.00";
                  DecimalFormat df = new DecimalFormat("#,###,###.##");
                  System.out.println(df.format(Double.parseDouble(x)));

                  when i print this value 24,668,124 is coming but i want with decimals like this24,668,124.00 ;
0
Comment
Question by:chaitu chaitu
  • 2
2 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 20013540
DecimalFormat df = new DecimalFormat("#,###,###.00");
0
 
LVL 35

Accepted Solution

by:
TimYates earned 2000 total points
ID: 20013546
# means put a number there if there is one

0 means put a number there if there is one, or "0" if there isn't
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question