Advertisement
Advertisement


cast string to int java android


Question

How can I convert a String to an int in Java?

My String contains only numbers and I want to return the number it represents.

For example, given the string "1234" the result should be the number 1234

 String Availability = json.getString("Availability");before parsing value ="4" 
 int x = Integer.parseInt(Availability);here after parsing it gives me 2 i don't know why 
2017/01/23
1
-2
1/23/2017 12:18:57 PM