I am trying to format a double to exact 2 decimal places if it has fraction, and cut it off otherwise using DecimalFormat
So, I'd like to achieve next results:
100.123 -> 100.12
100.12 -> 100.12
100.1 -> 100.10
100 -> 100
Variant #1
DecimalFormat("#,##0.00")
100.1 -> 100.10
but
100 -> 100.00
Variant #2
DecimalFormat("#,##0.##")
100 -> 100
but
100.1 -> 100.1
Have any ideas what pattern to choose in my case?