String.valueOf()
The String.valueOf function is the most commonly used function for the conversion of int to String in Java. The valueOf method belongs to the String class and is a static method. Let us look at the syntax for the same,
Syntax
String s=String.valueOf(i);
Java int to String Example using String.valueOf()
Java
The complete code will look like this,
class int_to_string{
public static void main(String [] args){
int number = 50;
String string_number = String.valueOf(number);
System.out.println("This is the Integer value + 100: "+ (number+100));
System.out.println("This is the String value + 100: "+ string_number+100);
}
}

You can also try this code with Online Java Compiler
Run Code

In the above code, we have the integer to string in Java conversion using String.valueOf() function. 100 gets added to the integer value, whereas it gets concatenated with the string value, thus producing different results and depicting the conversion from int to string in Java.
Also see, Duck Number in Java
Integer.toString()
The Integer.toString function is also a widely used function for converting int to String in Java. The toString method belongs to the String class and is a static method. Let us look at the syntax for the same,
Syntax
String s = Integer.toString(i);
Java int to String Example using Integer.toString()
Java
class int_to_string{
public static void main(String [] args){
int number = 50;
String string_number = Integer.toString(number);
System.out.println("This is the Integer value + 100: "+ (number+100));
System.out.println("This is the String value + 100: "+ string_number+100);
}
}

You can also try this code with Online Java Compiler
Run Code

In the above code, we have the integer to string in Java conversion using Integer.toString() function. 100 gets added to the integer value, whereas it gets concatenated with the string value, thus producing different results and depicting the conversion from int to string in Java.
String.format()
The String.format method is used to format a given Data type to the String Data type using its String format. Let us look at an example for conversion of int to string in Java using String.format(),
Syntax
class int_to_string{

You can also try this code with Online Java Compiler
Run CodeJava int to String Example using String.Format()
Java
public static void main(String [] args){
int number = 50;
String string_number = String.format("%d",number);
System.out.println("This is the Integer value + 100: "+ (number+100));
System.out.println("This is the String value + 100: "+ string_number+100);
}
}

You can also try this code with Online Java Compiler
Run Code

In the above code, we have the integer to string in Java conversion using String.format() function. 100 gets added to the integer value, whereas it gets concatenated with the string value, thus producing different results and depicting the conversion from int to string in Java.
Try it by yourself on Java Online Compiler.
Also check out Addition of Two Numbers in Java here.
Frequently Asked Questions
How many primitive data types are present in Java?
We have eight primitive or native data types in Java: int, short, long, byte, float, double, boolean, and char.
What are the three most commonly used methods for int to String conversion?
The three most commonly used methods in Java for the conversion of int to String are: String.valueOf(), “data_type”. toString(), String.format().
Why do we need to convert an int to a String?
The need for int to String conversion arises when the developers are provided with such huge numbers that they cannot be stored in the primitive Data types in Java.
What are primitive data types?
In computer programming, Primitive Data types are the set of variable types from which all the other data types are derived.
Conclusion
This blog explained the ways to convert an int to a String in Java, along with examples to help understand how to implement them.
Check out this problem - Multiply Strings
Recommended Readings:
Don’t stop here; check out Coding Ninjas for more unique courses and guided paths. Also, try Coding Ninjas Studio for more exciting articles, interview experiences, and fantastic Data Structures and Algorithms problems.