I have the following decimal format previously :
private static final DecimalFormat decimalFormat = new DecimalFormat("0.00");
So,
it can change :
0.1 -> "0.10"
0.01 -> "0.01"
0.001 -> "0.00"
What I wish is
0.1 -> "0.10"
0.01 -> "0.01"
0.001 -> "0.001"
Is it possible I can achieve so using DecimalFormat?
DecimalFormat class is not “Thread Safe”. So you are better off having static String variable for this format while you should define the DecimalFormat object within your method required method.
Static variable:
.
Local variable in method: