String number = "10";
int result = Integer.parseInt(number);
System.out.println(result);
Copyclass Scratch{
public static void main(String[] args){
String str = "50";
System.out.println( Integer.parseInt( str )); // Integer.parseInt()
}
}int result = Integer.parseInt(number);import com.google.common.primitives.Ints;
int foo = Optional.ofNullable(myString)
.map(Ints::tryParse)
.orElse(0)String toBeParsed = "15";
int parsedString = Integer.parseInt(String.valueOf(toBeParsed));
/*this makes the integer value of parsedString the number held
in the string toBeParsed*/
/*Side note: you will have to import java.lang.String to be
able to use Integer.parseInt() and String.valeOf() */String example = "1";
int converted = Integer.parseInt(example);