Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about converting arrays

 
Paul LaBrier
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're gonna have to use some kind of loop. Or even loops inside loops. Do some subscripting too, that helps.
-Barry
 
Max Habibi
town drunk
( and author)
Sheriff
Posts: 4118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Barkat Mardhani
Ranch Hand
Posts: 787
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic