In this tutorial, I am going to show to different ways to convert Java int to String.

Convert Java Int to String :

We can convert the Java Int to String on 6 different ways; those are listed below

1) Int to String – Integer.toString() :

int number = 895;
String str = Integer.toString(number);

2) Int to String – String.valueOf() :

int number = 895; 
String str = String.valueOf((number);

3) Int to String – new Integer().toString() :

int number = 895; 
String str = new Integer(number).toString();

4) Int to String – String.format (“%d”, number):

int number = 895; 
String str = String.format ("%d", number);

5) Int to String – StringBuffer:

int number = 895; 
StringBuffer sb = new StringBuffer();
sb.append(number);
String str = sb.toString();

You can simply append the “” (double quotes) to your int.

6) Int to String – Appending “”+:

int number = 895; 
String str = ""+number;

Happy Learning 🙂

About the Author:

Founder of onlinetutorialspoint.com Love Java, Python, Shell and opensource frameworks. Follow him on twitter and facebook for latest updates.

Leave A Comment