title: Why does Java report a mismatch when trying to print big random numbers?
body: <p>Java reports a Type mismatch exception when trying to print big numbers and stored an array. </p>
  
  <p>I'm currently learning some Java. One of the excercises of the course I'm doing, asks me to generate some random numbers and storing them inside an array. Everything works fine as long as I generate integers, I can print them without trouble using out.print.</p>
  
  <p>But, when I generate big numbers and try to print them, Java informs a type mismatch in the line where I have the for each loop. </p>
  
  <pre><code>package clases;
  
  public class Arrays_3 {
      public static void main (String [] args) {
          long [] array_random=new long[150];
          for (int i=0;i&lt;array_random.length;i++) {
              array_random[i]=(long)Math.round(Math.random()*100000) ;
          }
  
          for (long elemento:array_random) {
              System.out.println(array_random[elemento]);
          }
      }
  }
  </code></pre>
  
  <p>This is the error I get on Eclipse console after running the code above:</p>
  
  <pre class="lang-none prettyprint-override"><code>Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
      Type mismatch: cannot convert from long to int
  
      at clases.Arrays_3.main(Arrays_3.java:17)
  </code></pre>
  
  <p>Line 17 is where the <code>System.out.print</code> method is.</p>