Is it possible to store java.lang.Double to exactly two decimal places
Ex : 0.2
becomes 0.20
I modified the code to following
Double correlation = getSomeDoubleValue(label, key, date);
DecimalFormat df = new DecimalFormat("0.00");
correlation = Double.valueOf(df.format(correlation));
but when function getSomeDoubleValue()
returns 0.2
, df.format(correlation)
makes it 0.20
but as i need java.lang.Double
, then Double.valueOf("0.20")
gives me 0.2
back.
I am not sure how to achieve this or if its achievable at all.