aspose file tools
The moose likes Beginning Java and the fly likes Question about converting arrays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Question about converting arrays" Watch "Question about converting arrays" New topic
Author

Question about converting arrays

Paul LaBrier
Greenhorn

Joined: Apr 08, 2002
Posts: 21
I have an double subscripted array:
int grades[][] = { { 2772, 126, 169, 194, 177 },
{ 3375, 163, 188, 189, 185 },
{ 4456, 171, 190, 186, 198 } };
The first column is a ID# and the rest are grades.
I would like to create a new single subscript array that only contains the grades. What would be the best way to do this?
Thanks,
Paul
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
You're gonna have to use some kind of loop. Or even loops inside loops. Do some subscripting too, that helps.
-Barry


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
Well, since I don't want to solve my own Java problems right now...

HTH,
M, author
The Sun Certified Java Developer Exam with J2SE 1.4


Java Regular Expressions
Barkat Mardhani
Ranch Hand

Joined: Aug 05, 2002
Posts: 787
Hi Paul:

I would like to create a new single subscript array that only contains the grades. What would be the best way to do this?

In that case you will need tocreate single
subscript array as follows:

You will need to keep ID# in separate array that
matches that data layout in above array.
Thanks
Barkat
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
Originally posted by Barkat Mardhani:
Hi Paul:

You will need to keep ID# in separate array that
matches that data layout in above array.
Thanks
Barkat


Barkat,
I think that he meant he wanted to do this programatically.
HTH,
M, author
The Sun Certified Java Developer Exam with J2SE 1.4
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Question about converting arrays