473,503 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Formatting a double

1 New Member
Ok so I have this number 1.4316557653333333E9 and I need to format this number so I can print out 1431 million 655 thousand and 765

Here is my curent code:

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. import java.util.*;
  4. public class numberthree {
  5.  
  6.     public static void main(String[] args) {
  7.  
  8.         double DAY , space , mill , thou , hund; 
  9.  
  10.         Scanner keyboard = new Scanner(System.in);
  11.  
  12.         System.out.println("Please input the number of days MyMail has been running :");
  13.         DAY = keyboard.nextDouble();
  14.  
  15.         space =  ( (( 512 * Math.pow(2, 20) )/ 15 ) * DAY ) + (1024  * Math.pow(2, 20)) ;
  16.  
  17.  
  18.         System.out.println(space);
  19.  
  20.              mill = space / 1000000;
  21.              thou = space % 1000000;
  22.              hund = space % 1000;
  23.  
  24.  
  25.         System.out.printf("Email storage space (in bytes): " +  "%.2f" , mill + "million" +  thou +  "thousand" + hund);
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.     }
  34.  
  35.  
  36.  
  37. }
  38.  
Thanks for the help!
Sep 22 '11 #1
0 1604

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1323
by: bojanraic | last post by:
Hi! I am about to submit an article on a PHP-based site (BBCode is used for formatting), and I have a formatting problem: I am not sure how to print double quotes (" "). I tried some character...
3
1285
by: Keith | last post by:
Ok, so here is the code I have so far........my question is whether it is possible to hold onto the amount of hours for each car entered without erasing it through the next entry. I need a table...
2
1665
by: Homer Simpson | last post by:
Hi, I'm looking for a way to format the output of my double value. For example, the result of a calculation may be 12.3456789 but I want to display 12.346 (three decimal places of precision)....
2
2864
by: Carlos | last post by:
Hi all, just wanted to know how can I just quickly round to nearest 100th, and use the first two decimal places of a double value in a textbox, instead of all the decimals. Thanks in advance,...
10
3136
by: Coleen | last post by:
Hi all :-) I have a weird formatting problem with an HTML table that I am populating using VB.Net and HTML. Here is the snippet of code for the cell I'm trying to format: Dim...
1
4303
by: bsmith1111 | last post by:
I have a program that outputs the following to the screen (through visual c++) 9999999999, which is stored in a double. I would like to keep the number the way it is, but every time I output it...
14
4251
by: Scott M. | last post by:
Ok, this is driving me nuts... I am using VS.NET 2003 and trying to take an item out of a row in a loosely-typed dataset and place it in a label as a currency. As it is now, I am getting my...
11
3680
by: Ole Nielsby | last post by:
First, sorry if this is off-topic, not strictly being a C++ issue. I could not find a ng on numerics or serialization and I figure this ng is the closest I can get. Now the question: I want...
2
1320
by: Derek Hart | last post by:
I have a double stored in a DataTable: dt.Rows(i)(MergeFieldName) I want to format this and store it into a string. I have formatting stored in a database, such as "$#,##0.00"
13
1515
by: cj2 | last post by:
pages = 1 pages.tostring gives me "1" pages+1.tostring gives me "2.0" Why did it add the ".0" on there? I was looking for "2" and this screws me up. Actually this is what I was doing. In...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
399
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.