aspose file tools*
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
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)) ;
 
 
subject: Data Type/jdbc