There are multiple ways:

  • String.valueOf(number) (my preference)
  • "" + number (I don't know how the compiler handles it, perhaps it is as efficient as the above)
  • Integer.toString(number)
Answer from Bozho on Stack Overflow
๐ŸŒ
Browserling
browserling.com โ€บ tools โ€บ decimal-to-text
Decimal to Text Converter - Convert Decimal to String - Online - Browserling Web Developer Tools
Useful, free online tool that converts decimal integer values to plain text. No ads, nonsense, or garbage, just a dec to text converter. Press a button โ€“ get the result.
๐ŸŒ
Online String Tools
onlinestringtools.com โ€บ convert-decimal-to-string
Convert Decimal to a String โ€“ Online String Tools
Free online decimal to string converter. Just load your decimal and it will automatically get converted to a string. There are no intrusive ads, popups or nonsense, just a decimal to string converter. Load a decimal, get a string.
๐ŸŒ
Text Compare
textcompare.io โ€บ string-to-int-converter
String to INT Converter Online
String to Integer (INT) Converter is a tool that simplifies the conversion of textual data (strings) into integer values. In computer programming, strings are sequences of characters (text), and integers are numerical data types.
๐ŸŒ
Browserling
browserling.com โ€บ tools โ€บ text-to-decimal
Text to Decimal Converter - Convert Text to Decimal String - Online - Browserling Web Developer Tools
For example, if you're writing a web application that transfers messages using a simple non-binary text protocol, then it may get tricky to transfer multi-byte characters (such as Unicode symbols and emojis). With this utility, you can convert any text, Unicode glyphs, and multi-byte strings into ...
๐ŸŒ
Convert String
convertstring.com
Convert String - Online String Conversion tools
Convert String offers resources for converting strings between formats. If you need a fast free online tool for applying common string functions or string manipulation routines then you are in the right place!
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ different-ways-for-integer-to-string-conversions-in-java
Java Convert int to String | How to Convert an Integer into a String - GeeksforGeeks
April 9, 2025 - Using concatenation with an empty string. The Integer class has a static method toString() that returns a String object representing the specified int parameter. The argument is converted and returned as a string instance.
๐ŸŒ
PhraseFix
phrasefix.com โ€บ tools โ€บ decimal-to-string
Decimal to String Converter - PhraseFix
Free online tool that converts decimal to string. Simply enter the decimal and the online tool will convert it into text.
Find elsewhere
๐ŸŒ
Kjur
kjur.github.io โ€บ jsrsasign โ€บ sample โ€บ tool_intary.html
jsrsasign: Integer array converter
This tool converts from a string of integer array (ex. ' [ 123, 34, 101, ... ] ') to a hexadecimal string or raw string.
๐ŸŒ
CodeGym
codegym.cc โ€บ java blog โ€บ strings in java โ€บ how to convert int to string in java
Convert int to String in Java
December 18, 2024 - The easiest way to convert int to String is very simple. Just add to int or Integer an empty string "" and youโ€™ll get your int as a String. It happens because adding int and String gives you a new String.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ how-to-convert-an-integer-to-a-string-in-c
How to Convert an Integer to a String in C? - GeeksforGeeks
July 23, 2025 - We can convert an integer to a string manually by extracting each digit one by one and converting it to its corresponding character by using their ASCII code and storing it in the character array to form a string.
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ how-to-convert-an-integer-to-a-string-in-java
How to convert an integer to a string in Java
It returns a string. You can use it as a static function of the Integer class like this: ... Or, use the normal version of the Integer classโ€™ object. This cannot be used with the primitive type int, so remember to convert it to an Integer first by passing it to the constructor or simple assignment using โ€˜=โ€™ operator (see the example below) :
๐ŸŒ
WsCube Tech
wscubetech.com โ€บ resources โ€บ c-programming โ€บ programs โ€บ int-to-string
How to Convert Int to String in C? 3 Ways With Code
October 23, 2025 - Learn three simple ways to convert an int to a string in C using sprintf(), itoa(), and other methods. Includes code examples!
Top answer
1 of 16
983

Normal ways would be Integer.toString(i) or String.valueOf(i).

The concatenation will work, but it is unconventional and could be a bad smell as it suggests the author doesn't know about the two methods above (what else might they not know?).

Java has special support for the + operator when used with strings (see the documentation) which translates the code you posted into:

StringBuilder sb = new StringBuilder();
sb.append("");
sb.append(i);
String strI = sb.toString();

at compile-time. It's slightly less efficient (sb.append() ends up calling Integer.getChars(), which is what Integer.toString() would've done anyway), but it works.

To answer Grodriguez's comment: ** No, the compiler doesn't optimise out the empty string in this case - look:

simon@lucifer:~$ cat TestClass.java
public class TestClass {
  public static void main(String[] args) {
    int i = 5;
    String strI = "" + i;
  }
}
simon@lucifer:~$ javac TestClass.java && javap -c TestClass
Compiled from "TestClass.java"
public class TestClass extends java.lang.Object{
public TestClass();
  Code:
   0:    aload_0
   1:    invokespecial    #1; //Method java/lang/Object."<init>":()V
   4:    return

public static void main(java.lang.String[]);
  Code:
   0:    iconst_5
   1:    istore_1

Initialise the StringBuilder:

   2:    new    #2; //class java/lang/StringBuilder
   5:    dup
   6:    invokespecial    #3; //Method java/lang/StringBuilder."<init>":()V

Append the empty string:

   9:    ldc    #4; //String
   11:    invokevirtual    #5; //Method java/lang/StringBuilder.append:
(Ljava/lang/String;)Ljava/lang/StringBuilder;

Append the integer:

   14:    iload_1
   15:    invokevirtual    #6; //Method java/lang/StringBuilder.append:
(I)Ljava/lang/StringBuilder;

Extract the final string:

   18:    invokevirtual    #7; //Method java/lang/StringBuilder.toString:
()Ljava/lang/String;
   21:    astore_2
   22:    return
}

There's a proposal and ongoing work to change this behaviour, targetted for JDK 9.

2 of 16
258

It's acceptable, but I've never written anything like that. I'd prefer this:

String strI = Integer.toString(i);
๐ŸŒ
Arduino Forum
forum.arduino.cc โ€บ projects โ€บ programming
Convert int to string and print in serial monitor - Programming - Arduino Forum
April 11, 2024 - So I am receiving data over bluetooth which is in the form of ascii characters. So 255 comes in as 50,53,53 So what I need to do is convert the intergers into strings then concatenate the strings together then convert the new string back into a int. So myRecievednumbers is an array and in the ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ convert-integer-to-string-in-python
Convert integer to string in Python - GeeksforGeeks
This is similar to f-strings but works with older versions of Python (before 3.6). ... The %s keyword allows us to insert an integer (or any other data type) into a string.
Published ย  July 12, 2025
๐ŸŒ
Quora
quora.com โ€บ How-do-you-convert-int-to-string-manually
How to convert int to string manually - Quora
Handle sign: record sign = (n < 0). Work with absolute value (use unsigned or wider type if needed to avoid overflow: e.g., for INT_MIN). ... If sign was negative, append '-'. Reverse the output buffer to obtain the correct order. Return the buffer as a string.
๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ JavaScript โ€บ Reference โ€บ Global_Objects โ€บ parseInt
parseInt() - JavaScript | MDN
If not NaN, the return value will be the integer that is the first argument taken as a number in the specified radix. (For example, a radix of 10 converts from a decimal number, 8 converts from octal, 16 from hexadecimal, and so on.) The radix argument is converted to a number. If it's unprovided, or if the value becomes 0, NaN or Infinity (undefined is coerced to NaN), JavaScript assumes the following: If the input string, with leading whitespace and possible +/- signs removed, begins with 0x or 0X (a zero, followed by lowercase or uppercase X), radix is assumed to be 16 and the rest of the string is parsed as a hexadecimal number.