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.
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.