• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is there a library that deals with currency?  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm really new to Java and was wondering if there was a library in the API that deals with currency that could be used in monetary calculations or conversions?
 
Marshal
Posts: 58823
179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Difficult to be sure what you require. There is a Currency class, and up to J2SE1.4 you would have used DecimalFormat to print the result. Nowadays, you would use the formatting tags in System.out.printf for formatting; there are more details in the Formatter class API. You would use the BigDecimal class to do any arithmetic. Have a look at the Java Tutorial about formatting and currency.

And I hope that lot is of some help to you.

CR
 
Debi Manson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you! That's just what I needed.
 
Rancher
Posts: 4686
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Debi Manson:
if there was a library in the API that deals with currency that could be used in monetary calculations or conversions?



bless you for not using Floating Point for currency.
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might also check out the JScience library. In addition to supporting currencies it also supports a wide variety of unit and unit conversions (it's a reference implementation of JSR-275). Check out the API for more details.

Dave
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!