Temporary variable used for each iteration of a large loop, strings are immutable so what should I use?
<p>I have a loop like:</p>

<pre><code>String tmp;

for(int x = 0; x &lt; 1000000; x++) {


   // use temp


   temp = ""; // reset
}
</code></pre>

<p>This string is holding at most 10 characters.</p>

<p>What would be the most effecient way of creating a variable for this use case?</p>

<p>Should I use a fixed size array?  Or a stringbuffer instead?</p>

<p>I don't want to create 1million variables when I don't have to, and it matters for this method (performance).</p>

<p><b>Edit</b>
<strong>I simplified my scenerio, I actually need this variable to be at the class level scope as there are some events that take place i.e. it can't be declared within the loop.</strong></p>
