It looks like you're new here. If you want to get involved, click one of these buttons!
I have a string which only has numbers in it. I need to convert it to an integer. What is the best way to do it?
Ex. "5487" to 5487
You can use Integer.praseInt() as follows.
int intValue = Integer.parseInt("45112");
If you need more clarification, please visit this link.
As like David said use Integer.parseInt() method to convert a string to and integer. For more details and practice programs on Integer please follow the link http://java.meritcampus.com/t/350/Integer--long
Wrapper class Integer which is static is used for converting string into integer. parseInt() method of Integer class is used.
For more Details Refer following link: