convert string to int java

Java
String myString = "1234";
int foo = Integer.parseInt(myString);int result = Integer.parseInt(number);import com.google.common.primitives.Ints;

int foo = Optional.ofNullable(myString)
 .map(Ints::tryParse)
 .orElse(0)class Scratch{
    public static void main(String[] args){
        String str = "50";
        System.out.println( Integer.parseInt( str ));   // Integer.parseInt()
    }
}int i = Integer.parseInt(myString);
Source

Also in Java: