arrays

sort array of integers

Posted 10 August 2009 - 04:47 AM

hi guys.i'm putting 10 integers in an array of integers[] and then i want to sort them in ascending order.and therfore i used the sort method of java.util.Arrays. The problem is that the sorting isn't taken place and instead the resut is ten garbage letters or numbers.tnx fo any help guys:here's the code i have:

Re: sort array of integers

Posted 28 September 2009 - 02:57 PM

I don't mean to hijack someones post, but it sort of relates to my issue. I am trying to input a set of 10 numbers(4,5.3,7.2,1.8,99) and have an output in the reverse order they were entered. Here is what I have already.

Re: sort array of integers

Posted 28 September 2009 - 04:45 PM

j_lauer, on 28 Sep, 2009 - 01:57 PM, said:

I don't mean to hijack someones post, but it sort of relates to my issue. I am trying to input a set of 10 numbers(4,5.3,7.2,1.8,99) and have an output in the reverse order they were entered. Here is what I have already.

Re: sort array of integers

Posted 28 September 2009 - 05:14 PM

pbl, on 28 Sep, 2009 - 03:45 PM, said:

j_lauer, on 28 Sep, 2009 - 01:57 PM, said:

I don't mean to hijack someones post, but it sort of relates to my issue. I am trying to input a set of 10 numbers(4,5.3,7.2,1.8,99) and have an output in the reverse order they were entered. Here is what I have already.

If you want to output them in reverse order they were entered DON'T sort them
And just the reverse loop for(int i = 0; i >= 0; i--) that was displayed a few posts ago

i tried that, it reverse sorts them from highest to lowest. I am looking to reverse the order they were entered without sorting. An example is if I enter these numbers 5.0 4.4 1.9 2.9 3.4 3.5 the output should be 3.5 3.4 2.9 1.9 4.4 5.0 along with listing the lowest number entered. I understand the sorting, but i don't think i need to sort it to get the output.

Re: sort array of integers

Posted 28 September 2009 - 05:58 PM

j_lauer, on 28 Sep, 2009 - 04:14 PM, said:

i tried that, it reverse sorts them from highest to lowest. I am looking to reverse the order they were entered without sorting. An example is if I enter these numbers 5.0 4.4 1.9 2.9 3.4 3.5 the output should be 3.5 3.4 2.9 1.9 4.4 5.0 along with listing the lowest number entered. I understand the sorting, but i don't think i need to sort it to get the output.

Re: sort array of integers

Posted 28 September 2009 - 07:05 PM

pbl, on 28 Sep, 2009 - 04:58 PM, said:

j_lauer, on 28 Sep, 2009 - 04:14 PM, said:

i tried that, it reverse sorts them from highest to lowest. I am looking to reverse the order they were entered without sorting. An example is if I enter these numbers 5.0 4.4 1.9 2.9 3.4 3.5 the output should be 3.5 3.4 2.9 1.9 4.4 5.0 along with listing the lowest number entered. I understand the sorting, but i don't think i need to sort it to get the output.

Thanks
Jeremy

sorry if my post was confusing

That's exactly what I said
DO NOT SORT THEM

Arrays.sort(Nos);

Got it, I must have missed that on you last post. Now I need to tackle the "double int" part of the problem so I can use decimal point with the entries. Any idea how I could pick out the lowest entered number?