parse string to int java

Java
int result = Integer.parseInt(number);	String number = "10";
	int result = Integer.parseInt(number);			
	System.out.println(result);
String myString = "1234";
int foo = Integer.parseInt(myString);String example = "1";
int converted = Integer.parseInt(example);class Scratch{
    public static void main(String[] args){
        String str = "50";
        System.out.println( Integer.parseInt( str ));   // Integer.parseInt()
    }
}import com.google.common.primitives.Ints;

int foo = Optional.ofNullable(myString)
 .map(Ints::tryParse)
 .orElse(0)
Source

Also in Java: