top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

What is the max size of an array allowed in java?

+1 vote
69 views
What is the max size of an array allowed in java?
posted Aug 4, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

In Java, arrays internally use integers (int not Integer) for index, the max size is limited by the max size of integers. So theoretically it is 2^31-1 = **********, which is Integer.MAX_VALUE.

But in recent HotSpot JVM it has been observed that the max size of array can be Integer.MAX_VALUE - 5.

answer Aug 4, 2015 by Ashwini Borkar
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...