Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

Array length more than 0x7fffffff

How to create onedimensional array with length more than 0x7fffffff?
0
msterjev
Asked:
msterjev
1 Solution
 
Igor BazarnyCommented:
Hi,

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?

Regards,
Igor Bazarny,
Brainbench MVP for Java 1
www.brainbench.com 
0
 
exorcistCommented:
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.
0
 
objectsCommented:
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 :)

0
Technology Partners: 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!

 
stimpyjcatCommented:
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.
0
 
MoondancerCommented:
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.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

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.
http://www.experts-exchange.com/questions/Q.20006800.html
http://www.experts-exchange.com/questions/Q.20102283.html
http://www.experts-exchange.com/questions/Q.20103169.html
http://www.experts-exchange.com/questions/Q.20108297.html
http://www.experts-exchange.com/questions/Q.20116860.html
http://www.experts-exchange.com/questions/Q.20116861.html
http://www.experts-exchange.com/questions/Q.20117136.html
http://www.experts-exchange.com/questions/Q.20117165.html
http://www.experts-exchange.com/questions/Q.20117265.html
http://www.experts-exchange.com/questions/Q.20147259.html
http://www.experts-exchange.com/questions/Q.20150714.html
http://www.experts-exchange.com/questions/Q.20154666.html
http://www.experts-exchange.com/questions/Q.20167123.html
http://www.experts-exchange.com/questions/Q.20185818.html
http://www.experts-exchange.com/questions/Q.20191030.html
http://www.experts-exchange.com/questions/Q.20195232.html
http://www.experts-exchange.com/questions/Q.20197726.html
http://www.experts-exchange.com/questions/Q.20215346.html
http://www.experts-exchange.com/questions/Q.20186340.html
http://www.experts-exchange.com/questions/Q.20277739.html


To view your locked questions, please click the following link(s) and evaluate the proposed answer.
http://www.experts-exchange.com/questions/Q.20193591.html

PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  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 http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643

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.
 
Moondancer
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.
0
 
MoondancerCommented:
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.

Thanks,
Moondancer - EE Moderator
0

Featured Post

Technology Partners: 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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now