I have two cases
- Input-> 3,4,1
Get last value into a vector. so Vector cls contains 1. So for further processing I am converting it to integer
int c = Integer.parseInt(cls.get(0));
this works fine But for 2 nd case it fails.
- 3.0,4.0,1.0
Vector cls contains 1.0 and while converting to int it fails with NumberFormatException
int c= Integer.parseInt(cls.get(0));
Caused by: java.lang.NumberFormatException: For input string: "1.0" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
What can I do as a workaround by keeping Vector as String itself. Edit I need to work my code for both the cases.