I am studying Java 8 documentation for ArrayList. I got that maximum array size is defined as Integer.MAX_VALUE - 8 means 2^31 – 8 = 2 147
The value is a worst-case scenario. Note the comment:
Attempts to allocate larger arrays may result in OutOfMemoryError
It doesn't say will, just may. If you stay below this value, you should have no issue (as long as memory is available, of course).
You may want to look at the answers to this question for more information:
Why I can't create an array with large size?