Help solve the Java indexing problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Help solve the Java indexing problem

Gandler, William (NIH/CIT) [E]
HELP SOLVE THE JAVA INDEXING PROBLEM
VOTE FOR BUG ID 4963452
I am a Java programmer for the MIPAV image processing package at NIH.  We are experiencing a significant problem handling large images because Java arrays are indexed by 32 bit signed integers instead of by 64 bit signed integers.  Take a 5000 X 5000 X 5000 array for a large image.  (5000**3) = 1.25E11.  If I use the Java construct byte buffer[] = new byte[125000000000] to create a one dimensional array, I can only index from 0 to 2**31 - 1, or from 0 to 2,147,483,647.  In theory this problem could be circumvented by going thru MIPAV and rewriting all one dimensional arrays as arrays of arrays (In Java a 2D array is constructed as an array of arrays).  However, this is a very awkward and kludge solution, and the best solution would be for Sun to rewrite Java to index arrays with 64 bit integers.  I went to bugs.sun.com and found that back in December, 2003 a request to have 64 bit integer array indexing replace 32 bit integer array indexing in Java was filed as Bug ID 4963452.  If you type 4963452 for bug ID at bugs.sun.com, a paging error occurs.  Instead go to the link http://bugs.sun.com/view_bug.do?bug_id=4963452.  Sun addresses those bugs which get the most votes.  People who register at this website as a Sun developer can vote up to 3 times to have a bug fixed.  Developers can vote either for separate bugs or the same bug.  Help fix the array indexing bug by voting for 4963452.

                                                                                                     Sincerely,

                                                                                              William Gandler
Reply | Threaded
Open this post in threaded view
|

Re: Help solve the Java indexing problem

David Webster
What happens to code that uses 32 bit signed indexing?

David Webster

On Fri, Jun 26, 2009 at 1:55 PM, Gandler, William (NIH/CIT) [E] <
[hidden email]> wrote:

> HELP SOLVE THE JAVA INDEXING PROBLEM
> VOTE FOR BUG ID 4963452
> I am a Java programmer for the MIPAV image processing package at NIH.  We
> are experiencing a significant problem handling large images because Java
> arrays are indexed by 32 bit signed integers instead of by 64 bit signed
> integers.  Take a 5000 X 5000 X 5000 array for a large image.  (5000**3) =
> 1.25E11.  If I use the Java construct byte buffer[] = new byte[125000000000]
> to create a one dimensional array, I can only index from 0 to 2**31 - 1, or
> from 0 to 2,147,483,647.  In theory this problem could be circumvented by
> going thru MIPAV and rewriting all one dimensional arrays as arrays of
> arrays (In Java a 2D array is constructed as an array of arrays).  However,
> this is a very awkward and kludge solution, and the best solution would be
> for Sun to rewrite Java to index arrays with 64 bit integers.  I went to
> bugs.sun.com and found that back in December, 2003 a request to have 64
> bit integer array indexing replace 32 bit integer array indexing in Java was
> filed as Bug ID 4963452.  If you type 4963452 for bug ID at bugs.sun.com,
> a paging error occurs.  Instead go to the link
> http://bugs.sun.com/view_bug.do?bug_id=4963452.  Sun addresses those bugs
> which get the most votes.  People who register at this website as a Sun
> developer can vote up to 3 times to have a bug fixed.  Developers can vote
> either for separate bugs or the same bug.  Help fix the array indexing bug
> by voting for 4963452.
>
>
>                         Sincerely,
>
>
>                  William Gandler
>
Reply | Threaded
Open this post in threaded view
|

No problem with code using 32 bit signed indexing

Gandler, William (NIH/CIT) [E]
David Webster,

  Presently an array index can be an int value or a value of a type that can be promoted to int, that is, byte, short, or char.  Presently using a value of type long as an array index results in a compilation error.  If indexing is changed from 32 to 64 bits, an array index will be promoted to a long instead of to an int.  Programmers will have no need to change their code.
                                               William Gandler

-----Original Message-----
From: David Webster [mailto:[hidden email]]
Sent: Friday, June 26, 2009 9:36 PM
To: List IMAGEJ
Subject: Re: Help solve the Java indexing problem

What happens to code that uses 32 bit signed indexing?

David Webster

On Fri, Jun 26, 2009 at 1:55 PM, Gandler, William (NIH/CIT) [E] <
[hidden email]> wrote:

> HELP SOLVE THE JAVA INDEXING PROBLEM
> VOTE FOR BUG ID 4963452
> I am a Java programmer for the MIPAV image processing package at NIH.  We
> are experiencing a significant problem handling large images because Java
> arrays are indexed by 32 bit signed integers instead of by 64 bit signed
> integers.  Take a 5000 X 5000 X 5000 array for a large image.  (5000**3) =
> 1.25E11.  If I use the Java construct byte buffer[] = new byte[125000000000]
> to create a one dimensional array, I can only index from 0 to 2**31 - 1, or
> from 0 to 2,147,483,647.  In theory this problem could be circumvented by
> going thru MIPAV and rewriting all one dimensional arrays as arrays of
> arrays (In Java a 2D array is constructed as an array of arrays).  However,
> this is a very awkward and kludge solution, and the best solution would be
> for Sun to rewrite Java to index arrays with 64 bit integers.  I went to
> bugs.sun.com and found that back in December, 2003 a request to have 64
> bit integer array indexing replace 32 bit integer array indexing in Java was
> filed as Bug ID 4963452.  If you type 4963452 for bug ID at bugs.sun.com,
> a paging error occurs.  Instead go to the link
> http://bugs.sun.com/view_bug.do?bug_id=4963452.  Sun addresses those bugs
> which get the most votes.  People who register at this website as a Sun
> developer can vote up to 3 times to have a bug fixed.  Developers can vote
> either for separate bugs or the same bug.  Help fix the array indexing bug
> by voting for 4963452.
>
>
>                         Sincerely,
>
>
>                  William Gandler
>