title: Java can't add my total_value's to a new array with 100 slots
body: <p>I have written made a program in Java that "walks" 500 random steps either back or forward (-1 or +1). The end steps (where it stops after 500 steps) is being printed to the console. I want these to be stored in a list where it'll tell me how many times the end step landed on, let's say -5. The end step needs to be looped 100 times:</p>
  
  <pre><code>public class RandomWalk {
  
      public static void main(String[] args) {
          int[] y;
          for(int i = 0; i &lt; 100; i++){
  
              int[] x;
              x = new int[500];
              for (int i1 = 0; i1 &lt; 500; i1++){
                   int L = (int) (Math.random()*2);
                   x[i1] = (L==0) ? -1 : 1;
              }
              int total_value = 0;
              for (int i1 = 0; i1 &lt; 500; i1++)
                  total_value += x[i1];
  
                  System.out.println("Total: "+ total_value);
          }
      }
  }
  </code></pre>
  
  <p>How can I query and return the result?</p>