?
=?iso-8859-1?B?bW9vcJk=?=
Hi,
The code
int n = (int) java.lang.Math.round(Double.parseDouble((String)
args.get(0)));
r = (int) java.lang.MathException in thread "main"
resulted in the following ex:
java.lang.NumberFormatException: For input string: "5.0"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:456)
at java.lang.Integer.parseInt(Integer.java:497)
The args.get(0) represents "5.0" as input. I have tried the most common
way
int n = Integer.parseInt((String) args.get(0));
but eventually failed and later evolved to the version as at the front
of this post. BTW, I use JAVA REFLECTION to do so. The code is inside a
class which is called by a reflection procedure.
What is it going wrong? Thx~!
The code
int n = (int) java.lang.Math.round(Double.parseDouble((String)
args.get(0)));
r = (int) java.lang.MathException in thread "main"
resulted in the following ex:
java.lang.NumberFormatException: For input string: "5.0"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:456)
at java.lang.Integer.parseInt(Integer.java:497)
The args.get(0) represents "5.0" as input. I have tried the most common
way
int n = Integer.parseInt((String) args.get(0));
but eventually failed and later evolved to the version as at the front
of this post. BTW, I use JAVA REFLECTION to do so. The code is inside a
class which is called by a reflection procedure.
What is it going wrong? Thx~!