• Post Reply Bookmark Topic Watch Topic
  • New Topic

sorting my numbers with using key id also  RSS feed

 
harikrishnan venkatesan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
can anyone help me to sort my numbers like this..

my numbers -
key - values

3 - 10
1 - 30
2 - 10
4 - 20
5 - 30
first compare mr values.. if same valye detect means again compare that particulars values using their keys and print that order

i a expecting this output;;;;;
10 10 20 30 30
2 4 4 3 5

pleae tell me the logic find out this......


 
Campbell Ritchie
Marshal
Posts: 56553
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you think you would sort them? After you have read about sorting here, that is.
 
Dinesh Kumar Ramakrishnan
Ranch Hand
Posts: 87
AngularJS Chrome Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use this following library method to sort the data of an array

java.util.Arrays.sort(Your Array Here[]);

this method sort the given array and store the sorted elements in the same array

here some examples to sort an array elements...Array Sorting Examples
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!