Convert String to int in Java

Problem

Given the following String containing a textual representation of an int:

String s = "1";

How to convert this String to an int?

Solution

int i = Integer.parseInt(s);