Here are some conversions which converts ASCII, integer, float, double and long values to String.
Conversion from ASCII code to String:
We can convert ASCII code into String by creating Character Wrapper class and calling its toString() method.
int i = 62;
String asciiChar = new Character((char)i).toString();
System.out.println("Ascii value of "+i+" is : "+asciiChar);
Output is :
Ascii value of 62 is : >
Conversion from double to String :
We can convert double to String using Double wrapper class and toString() method as follows :
double d = 42.0;
String doubleStr = Double.toString(d);
Conversion from integer to String.
You can convert an integer to String using Integer wrapper class and its the toString() method as follows.
int int = 77;
String str = Integer.toString(int);
Similarly we can convert long to String:
long l = 77;
String str = Long.toString(l);
Conversion from float to String :
float fl = 77.0f;
String str = Float.toString(fl);