Java array with more than 4gb elements

Java array indices are of type int (4 bytes or 32 bits), so I’m afraid you’re limited to 231 − 1 or 2147483647 slots in your array. I’d read the data into another data structure, like a 2D array.

Leave a Comment