I need to create a large integer array but I am not able to increase its size beyond max int value.
How do I create larger arrays?
titan5 0 Junior Poster in Training
Recommended Answers
Jump to PostI don't believe an array in Java can be larger than MAX_INT elements because arrays are indexed by ints. Of course you could use a linked list or some other structure that doesn't rely on indices, but if you absolutely must have an array, you could create your own class, …
Jump to PostIs this an assignment that you have or a possible solution to your problem? If it is the latter it's possible that there are better solutions - would you like to post the problem?
Jump to PostThere are 2 flags you can pass to the JVM:
java -Xms<initial heap size> -Xmx<maximum heap size>
According to this article, the defaults are (initial) 32MB and (max) 128 MB. So if you pass larger numbers to the JVM, you will have more memory allocated to the …
All 12 Replies
kramerd 29 Posting Pro in Training
apines commented: Short, precise and to the point. +4
apines 116 Practically a Master Poster Featured Poster
csmgsarma -6 Newbie Poster
Dhruv Gairola -3 Junior Poster in Training
Taywin 312 Posting Virtuoso
titan5 0 Junior Poster in Training
titan5 0 Junior Poster in Training
kramerd 29 Posting Pro in Training
titan5 0 Junior Poster in Training
kramerd 29 Posting Pro in Training
titan5 0 Junior Poster in Training
afas87 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.