Java input char to get int from string
1 String input = stdin.readLine(); // from console input example above. 2  Use the Integer class to parse the string of characters into an integer. 3  int number = Integer.parseInt(input); // converts a String into an int value. 4  In our case, we needed to convert a String into an int value. In our case, we needed to convert a String into an int value. 2  The parseInt method of the Integer class performs this action. 3  Be sure to review the Integer class javadoc for more information about this and other methods of the Integer class.