title: Maximum array length in java Integer.MAX_VALUE is not working
body: <p>Trying to get maximum array length. I found on net that maximum array length is actually maximum integer value.</p>
  
  <p>I used in my code this piece of code:</p>
  
  <pre><code>int[] array = new int[Integer.MAX_VALUE]; // 2^31-1 = 2147483647
  </code></pre>
  
  <p>And i get this kind of error :</p>
  
  <pre><code>Exception in thread "main" java.lang.OutOfMemoryError: Requested array size exceeds VM limit
      at IntMaxValueArrayLength.main(IntMaxValueArrayLength.java:7)
  </code></pre>
  
  <p>I also found on internet that 2^31-1 can't be maximum value, that i need to 
  subtract some numbers, i tried to subtract like 100000 but still get the same error.</p>