The Java code is as follows:
String s = "0.01";
int i = Integer.parseInt(s);
However this is throwing a NumberFormatException... What could be going wrong?
0.01 is not an integer (whole number), so you of course can't parse it as one. Use Double.parseDouble
or Float.parseFloat
instead.