This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Data Type/jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Data Type/jdbc" Watch "Data Type/jdbc" New topic
Author

Data Type/jdbc

j123
Greenhorn

Joined: Sep 09, 2001
Posts: 5
I would like to get and answer for how to store a twenty digit nuber with 2 decimals in java?
i would liket to print in in the screen
is there is any data type called Bigdigit?
I tried with double but its not working.,What should i do for that?
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Originally posted by j123:
I would like to get and answer for how to store a twenty digit nuber with 2 decimals in java?
i would liket to print in in the screen
is there is any data type called Bigdigit?
I tried with double but its not working.,What should i do for that?

maybe java.math.BigDecimal?
Jamie
Yogen Vadnere
Ranch Hand

Joined: Sep 20, 2001
Posts: 58
Hello,
Please try this...

double db = 12345678901234567890.12 ;
NumberFormat converter = NumberFormat.getInstance() ;
converter.setMaximumFractionDigits(2);
converter.setMinimumFractionDigits(2);
System.out.println( converter.format(db)) ;


Yogen Vadnere
Yogen Vadnere
Ranch Hand

Joined: Sep 20, 2001
Posts: 58
Hello,
Please try this...

double db = 12345678901234567890.12 ;
NumberFormat converter = NumberFormat.getInstance() ;
converter.setMaximumFractionDigits(2);
converter.setMinimumFractionDigits(2);
System.out.println( converter.format(db)) ;
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Data Type/jdbc
 
Similar Threads
Retrieve Images from oracle
subtracting char's
Error reading resource Hibernate
Question regarding the Enumertaion and Generics
Store Object in Database