I am looking for a NumberFormat configuration that format with signifant digits only applied to the fraction parts (and not on both integer and fraction parts).
Here are the expected results for the following examples (2 significants applied on the fraction part) :
0.00193 ---> 0.0019
0.46000 ---> 0.46
0.46365 ---> 0.46
0.46987 ---> 0.47
0.40000 ---> 0.40
0.40003 ---> 0.40
1.02000 ---> 1.02
1.02456 ---> 1.02
1.00000 ---> 1.00
1.00003 ---> 1.00
1.10000 ---> 1.10
125.1567 ---> 125.16
125.0005 ---> 125.00
142.1 ---> 142.10
Lot of solutions exist to format with significants digits, but offen applied to the integer part too. I think the solution would be a mix between the use of DecimalFormat and a BigDecimal.
Thanks for your answers ;)