how-to

Conversion between types

Number to String

Conversion between numbers types are very similary, you must only use proper static method of correct class.

Int to String

int i = 10;
String s = Integer.toString( i );

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

Long to String

long l = 456;
s = Long.toString( l );

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

Double to String

double d = 5.51;
s = Double.toString( d );

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

Float to String

float f = 15.55f;
s = Float.toString( f );

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