Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Question about Arrays

$
0
0
Hello, I have a question about arrays in java... I am trying to take an array and make another array out of it from each subscript. Is this possible?

For example, say I have an array called 'numbers' that has 10 elements in it (22,31,97,...and so on)
I want to take the [0] element from 'numbers' and make an array out of it so the new array will have (2,2).
Then I could make ten arrays out of the ten elements from 'numbers'. Like the next one would have 3 for the [0] element and 1 for the [1] element.

The reason why I am wanting to do this is cause I have a program that is reading data from a text file and storing it into an array. This array contains numbers like (271, 321, 488). I need to form an array from each element so I can pass that into a switch statement. These three digit numbers are supposed to represent a three digit instruction set...so I need to be able to pick out the 2 from 271 and so on in order to tell the program what action to take.

Any suggestions will be greatly appreciated! I'm still very new to Java. :)/>
Thanks.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>