Solved

Array length more than 0x7fffffff

Posted on 2001-07-07
6
240 Views
Last Modified: 2010-04-16
How to create onedimensional array with length more than 0x7fffffff?
0
Comment
Question by:msterjev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 7

Expert Comment

by:Igor Bazarny
ID: 6262065
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
 
LVL 3

Expert Comment

by:exorcist
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.
0
 
LVL 92

Expert Comment

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

0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 3

Expert Comment

by:stimpyjcat
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.
0
 
LVL 1

Accepted Solution

by:
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.
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
 
LVL 1

Expert Comment

by:Moondancer
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.

Thanks,
Moondancer - EE Moderator
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

635 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