I was solving a programming problem on a website and I hit a roadblock for the specific problem that I have to solve. The problem is of a command line image editor. Each image is a multidimensional array.
Now the problem is, I have to store images dynamically in a multidimensional array every time the user hits a save command. Since the user can save multiple times, I would have multiple images to store. Along with the image itself, the array would also contain the number of the image.
This was what I thought of - a three dimensional array looking like this:
1 2 3 4
_ 3 4 5
_ 5 6 7
2 6 7 8
_ 7 8 9
Here, the left most column is the number of the image, while the block of numbers next to it is the image itself. The new image starts at the next number.
I'd like to know how to make such an array. Also, if a more efficient way of working things out is possible, I'd be very glad to listen to suggestions.
Luigi Plinge wrote:Just create an image class with the image array as a field. Then store each one in an List (or maybe a Stack would be more appropriate if you're talking about undos).
What do I win?
Oh yeah. No undos involved so a List it shall be.
Seetharaman Venkatasamy wrote:Welcome to JavaRanch Anurag