can someone tell me how to convert a double variable to 2 decimals? I try using the below code but it cannot work.
DecimalFormat df = new DecimalFormat("0.00");
String a = df.format(123.5%11);
double AA = Double.parseDouble(a);
for instance i want AA = 2.50 instead of 2.5. the program keep on giving me 2.5.
I need the data type to be Double but not String.