Java best practices - money variables

this is more of a generic question than anything.

I am new to java and wanted to know your thoughts on something.

If I wanted to parse money values (two decimal places) from a string and so I could sum a running total, what would be the best variable type to use?

Everything I have been seeing on generic Java forums says bigdecimal (which is not recognized in apiant).


Yes, you can and should use BigDecimal:

You need to add an import of java.math.BigDecimal at the top of the JSP.

duh. i feel dumb now. ha


I get that feeling myself every day, ha.

1 Like