• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sort rows from a group of Integers  RSS feed

 
fredy salgado
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to organize the rows from the lower to the higher number, the problem is, what I have only organizes the first 3 rows even If I insert 3,4,5...or 10 rows.

What am I doing wrong?

 
Junilu Lacar
Sheriff
Posts: 11476
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look closely at line 8 and understand what it is doing.
 
Tushar Goel
Ranch Hand
Posts: 934
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you are using 4 loops to do the same. It is very bad.

If you want sort per row then use Arrays.sort utility on each row. You will get then each row sorted.

If you want whole array's of array as sorted then changed it into to single array or list then sort it out as i mentioned
above.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!