---
title: "How to convert from int to String in java?"  
description: "How to convert from int to String in java?"  
author: "Anonymous User"  
published: 2015-08-04  
updated: 2015-08-04  
canonical: https://www.mindstick.com/forum/33392/how-to-convert-from-int-to-string-in-java  
category: "java"  
tags: ["java", "string"]  
reading_time: 1 minute  

---

# How to convert from int to String in java?

I'm working on a [project](https://www.mindstick.com/articles/105927/how-to-excel-at-managing-multiple-projects) where all conversions from [int](https://www.mindstick.com/forum/159137/how-to-convert-date-int-to-date-in-sql) to [String](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) are done like this:

```
int i = 5;String strI = "" + i;
```

I'm not familiar with Java. Is this usual [practice](https://yourviews.mindstick.com/story/1498/terrific-benefits-of-a-morning-meditation-practice) or is [something wrong](https://www.mindstick.com/forum/12790/something-wrong-with-gridview), as I suppose?

## Replies

### Reply by Anonymous User

```
1. Integer.toString(i)2.  String.valueOf(i)
```

The concatenation will work, but 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 docs) which translates the code you posted into:

```
StringBuilder sb = new StringBuilder();sb.append("");sb.append(i);String strI = sb.toString();
```


---

Original Source: https://www.mindstick.com/forum/33392/how-to-convert-from-int-to-string-in-java

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
