File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes ArrayIndexOutOfBounds Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "ArrayIndexOutOfBounds" Watch "ArrayIndexOutOfBounds" New topic
Author

ArrayIndexOutOfBounds

RJ Cavender
Ranch Hand

Joined: Jul 26, 2006
Posts: 51
Hello, this is one of those "it SHOULD work" things. Im getting an ArrayOutOfBounds error and not being too familar with it, I thought someone might be able to help point me to the trouble maker. It seems to refer to line #582 and #32. Anybody been through this type of error?

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
this looks suspicious


if 'count' represents the size of the array, the loop should be
for(i=0; i<count; ++i)// '=' removed
Hyndavi Padamata
Greenhorn

Joined: Apr 19, 2007
Posts: 12
Hi,

I think What Dunn suggested is right.

Because if count represents size of the array, array index will starts from zero and ends with n-1 (where n is the length of the array). So with the condition the loop will iterate through nth element also. So there is a chance to get ArrayIndexOutOfBounds Exception.
RJ Cavender
Ranch Hand

Joined: Jul 26, 2006
Posts: 51
Thank you very much. That helped.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ArrayIndexOutOfBounds
 
Similar Threads
Logic behind deleting
Finding and changing array elements
Passing count
Incompatible types
BufferedReader help