title: What is more efficient? Storing a split string in an array, or calling the split method everytime you need it
body: <p>What is going to be faster, storing a split string into an array and using this array within my program, or could I call the .split() method on the string whenever I needed an array to iterate through?</p>
  
  <pre><code>String main = "1,2,3,4,5,6"; 
  String[] array = main.split(",");
  </code></pre>
  
  <p>vs</p>
  
  <pre><code>main.split(",");
  </code></pre>
  
  <p>whenever I need to use the input values?</p>
  
  <p>I realise it will be way more readable if I were to store the string in an array. I'd just like to know if the .split() takes more computing time than using an array. Since the split method returns an array containing the split strings.</p>
  
  <p>A simple example(?) loop to go with the question:</p>
  
  <pre><code>for (int i = main.length - 1; i &gt;= 0; i--){}
  </code></pre>
  
  <p>vs</p>
  
  <pre><code>for (int i = main.split(",") - 1; i &gt;= 0; i--){}
  </code></pre>