The Integer wrapper class of the java.lang package provides a method named parseInt() using this method you can convert a String variable to an integer variable.
public class Test { public static void main(String args[]) { String data = "123"; int num = Integer.parseInt(data); System.out.println(data); } }
123