The Integer Object has a parseInt method that returns an int from a String.
int output = Integer.parseInt( input );
It is recommended to use this method as Objects can be cached.
Here is an example where the String input is parsed using the method and the output is printed in System.out.
public class IntegerParseInt { public static void main(String[] argv){ String input = "5"; int output = Integer.parseInt( input ); System.out.println( "The int value for the String "+ input + " is " + output ); } }
The int value for the String 5 is 5