title: need a formula for setting indexes of an arraylist using 2 for loops
body: <p>I'm trying to use 2 for loops to set each value of each element in the arraylist to zero. Problem is that I need a formula to set each index to be 0 through 9. This formula would be placed where it says "FORMULA" in the below code. My desired result would be a printed line of {0,0,0,0,0,0,0,0,0,0,} using the exact same code as below but with "FORMULA" being replaced with an appropriate formula to set the correct index through each loop. Let me know if you need further a explanation.</p>
  
  <pre><code>import java.util.ArrayList;
  
  public class ArrayListPractice {
  
      public static ArrayList&lt;Integer&gt; x = new ArrayList&lt;Integer&gt;();
  
      public static void main(String args[]){
           setArrayValues();
           System.out.println(x);
       }
  
      private static void setArrayValues() {
          for(int i=0; i&lt;10; i++){
              x.add(i);
          }
          for(int i=0; i&lt;5; i++){
              for(int j=i+1; j&lt;5; j++){
                  x.set(FORMULA, 0);
              }
          }
  
      }
  
  }   
  </code></pre>