aspose file tools*
The moose likes Beginning Java and the fly likes Two dimensional array problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Two dimensional array problem" Watch "Two dimensional array problem" New topic
Author

Two dimensional array problem

Joshua Waring
Greenhorn

Joined: Sep 04, 2012
Posts: 13


I have no idea what the problem is, I'm trying to read an image and place the colour inside an array which I'll use as a height map later, but right now... How to get pixel colour into a two dimensional array.
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1067
    
  10

Do we have to guess what the symptoms of the problem are or are you willing to share them?
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Your for loop conditions are not correct. You are trying to set WIDTH + 1 and HEIGHT + 1 element, but you only have WIDTH and HEIGHT of them in your arrays.


The quieter you are, the more you are able to hear.
Joshua Waring
Greenhorn

Joined: Sep 04, 2012
Posts: 13
My silly mistake an array of 10 index's starts at 0 and ends at 9
I was going from 0 to one higher than the arrays length.

And the error was a arrayoutofbound
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Two dimensional array problem