currency « float « Java Data Type Q&A





1. How to parse a currency Amount (US or EU) to float value in Java    stackoverflow.com

In Europe decimals are separated with ',' and we use optional '.' to separate thousands. I allow currency values with:

  • US-style 123,456.78 notation
  • European-style 123.456,78 notation
I use the next ...

2. Why not use Double or Float to represent currency?    stackoverflow.com

So I've always been told NEVER to do this, and this time I pose the question to you: why? I'm sure there is a very good reason, I simply do not ...

3. Formatting floats (for currency amounts)    forums.oracle.com

I want to display in a JSP page currency amounts, so the numbers have 2 decimal places. I have a JavaBean with float amounts, but whenever I print the numbers I get 80.0 instead of 80.00. What's the simplest way to format the results to be two decimal places? I read some things about using BigDecimal and stuff but is there ...