money « bigdecimal « Java Data Type Q&A





1. Representing Monetary Values in Java    stackoverflow.com

I understand that BigDecimal is recommended best practice for representing monetary values in Java. What do you use? Is there a better library that you prefer to use instead?

2. Java: What is the right way to convert String into a valid amount of money(BigDecimal)    stackoverflow.com

I have to convert an incoming String field into a BigDecimal field that would represent a valid amount of money, for example:

String amount = "1000";

BigDecimal valid_amount = convert(amount);

print(valid_amount.toString())//1000.00
What is the right ...

3. BigDecimal money format chop off to 2 decimal    coderanch.com

hi. i wanna to money format with 2 decimal. if no decimal, just append . 2 zero. if 3 or more decimal. just chop off instead of rounding up. output :- //1727 => 1727.00 //1727.1 => 1727.10 //1727.23 => 1727.23 //1727.236 => 1727.23 //1727.231 => 1727.23 ------------------------------------------------------------------------------------- import java.math.BigDecimal; public class TestBigDecimal { public static void main(String[] args) { //1727 => ...