I have a few doubles in my code that need to output with no more than two decimal places while ignoring trailing zeros. For example:
2.0334=2.03
10.20=10.2
24.0032=24
I also have other doubles that I have to output with different formats, including trailing zeros and different precisions. Multiple formats may be output in the same System.out.format() line. From what I know about DecimalFormat (which, admittedly, isn't much), I can't output two decimals with different formats on the same line. I'm trying to use System.out.format() for that reason, but I can't make it ignore trailing zeros. Is this possible, or am I stuck with only DecimalFormat? Thanks!