I do not understand this. I tried the following:
double procent = 0;
int antalRätta = 5;
int antalFela = 1;
DecimalFormat df = new DecimalFormat("#.##");
procent = (double) (antalRätta/(antalRätta+antalFela)) * 100;
double procentMsg = Double.parseDouble(df.format(procent));
And procent
prints out 0.0
. Why?
Edit: If I change to double, I get:
Exception in thread "main" java.lang.NumberFormatException: For input string: "83,33"