how-to

Conversion between types

Number to String

String to int

String s = "555";

int i = Integer.parseInt( s );

System.out.println( i );  // write result to Output window
The output is:
555

Double to String

String s = "555.5";

double d = Double.parseDouble( s );

System.out.println( d );  // write result to Output window
The output is:
555.5

String to int with Integer class


Other variant for conversion is to use "wrapper" class - for example Integer class for int. This example shows String to int conversion with helping of Integer class.
String s = "555";

Integer i = Integer.valueOf( s );

System.out.println( i.intValue() );  // write result to Output window
The output is:
555