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

Array problems

james falk
Ranch Hand

Joined: Nov 02, 2012
Posts: 55
Hey all,

I am having some trouble with an array. I am wondering how I initialize a 2d array with values? For instance, if I want to create a 2d array with values 1-10 in each of the arrays, how do i do that?

Here's what I tried:

But this gave me wonky results...

Any thoughts?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42950
    
  72
You can't just work on the values of the pixels directly - those contain the values of R, G, and B all in one pixel. You need to do the averaging separately for the R, G and B components of each pixel. Something like
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42950
    
  72
Um, did you just edit your post all out of context?
james falk
Ranch Hand

Joined: Nov 02, 2012
Posts: 55
Yeah, sorry about that. I figured out what I was doing wrong, had another question, and thought I could edit it before anyone responded. Sorry for the confusion. Thanks for the help btw.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Array problems