I am using velocity template for generating pdf file. In this I have to show currency amount in the format like $ 7,242.84 or $ 0.00 or $ 410.70. I am using NumberTool class and in .vm file I am using something like $number.format("###0.00",$amount).
This is working fine in case if amount is 7242.8423 but if amount is 0.00 then it prints $ 0 if amount is 410.70 then $ 410.7.
Please tell me how I can use a proper formatting here.
Java already defines multiple number/currency formats based on locale. Please see the following to get the details.
https://docs.oracle.com/javase/tutorial/i18n/format/numberFormat.html