I got response from HTTP server as a string containing values separated by commas. I am separating those values at the client side by using comma as delimiter. But I need to convert it into integer in order to use it in my function. I used Integer.parseInt, but it is not converting.Can anyone please help.
This is the code which gets response from httpserver
HttpResponse response = client.execute(post);
String responseStr = EntityUtils.toString(response.getEntity());
System.out.println("Response is " + responseStr);
separated = responseStr.split(",");
int numbers = new int[separated.length];
for(int i = 0;i < separated.length;i++)
numbers[i] = Integer.parseInt(separated[i]);
System.out.println(separated + "and " + separated + "and " + separated);
15876.0 is not an integer. You should have received a NumberFormatException.
You could use numbers[i] = (int)Float.parseFloat(separated[i]);
if you just need the integer part.