Array length more than 0x7fffffff

Posted on 2001-07-07
Last Modified: 2010-04-16
How to create onedimensional array with length more than 0x7fffffff?
Question by:msterjev

Expert Comment

by:Igor Bazarny
ID: 6262065

Are you sure you need such a big array. As far as I understand, such array won't fit in 32-bit address space in most cases. Why do you think you need such a huge size?

Igor Bazarny,
Brainbench MVP for Java 1 

Expert Comment

ID: 6263039
Imagine it was an array of bytes. It would consume 2GB of memory! Your problem might not even be a java problem but a problem of the underlying Operating System.
LVL 92

Expert Comment

ID: 6263777
Don't think it's possible.
Not sure what your requirments are but maybe have a look for a good Sparse Array implementation. May suit, may not :)

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Expert Comment

ID: 6272928
Short answer: you don't.

Long answer: 0x7ffffff is the largest positive value that will fit into a Java int (32 bits).  32 bits is alse the most memory space your program could possibly have on most current platforms.  So even if your array were allocated, you would have no room for your program.

As suggested above, when you start talking about data storage or access of this size, you *don't* want to use an array.  There are other alternatives that are better-suited to large datasets (databases) or sparse data sets (hash tables).

Look up the Java API for HashTable (and various other Sets and Collections) and see if one of those might be more suitable to your purposes.

Accepted Solution

Moondancer earned 0 total points
ID: 6878649
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if still open in seven days.  Please post closing recommendations before that time.

Question(s) below appears to have been abandoned. Your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.

Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.  Anytime you have questions which are LOCKED with a Proposed Answer but does not serve your needs, please reject it and add comments as to why.  In addition, when you do grade the question, if the grade is less than an A, please add a comment as to why.  This helps all involved, as well as future persons who may access this item in the future to seek help.

To view your open questions, please click the following link(s) and keep them all current with updates.

To view your locked questions, please click the following link(s) and evaluate the proposed answer.

------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.  Also, if you are interested in the cleanup effort, please click this link

Moderators will finalize this question if still open in 7 days, by either moving this to the PAQ (Previously Asked Questions) at zero points, deleting it or awarding expert(s) when recommendations are made, or an independent determination can be made.  Expert input is always appreciated to determine the fair outcome.
Thank you everyone.
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.

Expert Comment

ID: 6888489
I refunded your 20 points to you awarded me in error.  I asked that I not be granted points, since I am a Moderator here and did not provide you any technical guidance; others did.

Please post a new question in this topic area for the expert or experts who did help you here to award them points for their efforts/help given.  This is done as follows:

New question entitled __Points for expertname__ in the comment field, paste the URL to this question.  The expert(s) will then comment or propose an answer for you to accept and grade to complete.

If you have questions in this regard, let me know.

Moondancer - EE Moderator

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jar file executable 12 58
replace a word with other 1 45
hibernate example for saving data 19 52
running on tomcat not jboss eap 7.0 3 17
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question