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 :)

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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
Detect Closed Loops (circles, figure-8s, etc) in PNG Images 6 74
java example issue 5 42
Notify sent to other threads in Java 9 41
JDBC performance 8 28
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

763 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