• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Sort an array in ascending order?  RSS feed

 
Rani Padmaja
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All,

How to Sort an array in ascending order? Can any one please provide the sample program for the reference.


Thanks
 
ShaikSalam Bashoeb
Greenhorn
Posts: 24
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please refer to below url which explains sorting an array very simple and excellent.

http://www.javasnippet.com/sorting/sorting-an-array.html
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch Rani Padmaja

I am afraid there was nothing excellent about that link; it was very basic and explained nothing about how one ought to sort.
What have you achieved so far?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rani Padmaja wrote:How to Sort an array in ascending order? Can any one please provide the sample program for the reference.
Thanks

We don't do that here. We won't provide you with a solution. If you show us what you have written, we will happily help you refine it and get it to work.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Rani Padmaja.

Is this homework; are you required to implement a sorting algorithm yourself? If not, then you could use one of the methods in the class java.util.Arrays (look it up in the API documentation).
 
Rani Padmaja
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replies.

Yes, It was a home work for me. I got the basic program from below url.

http://www.javasnippet.com/sorting/sorting-an-array.html

Three Cheers for him!!!
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rani Padmaja wrote:Thanks for your replies.

Yes, It was a home work for me. I got the basic program from below url.

http://www.javasnippet.com/sorting/sorting-an-array.html

Three Cheers for him!!!
Not at all. That is no way to learn, and if is it assessed work, you will doubtless get 0 because you have used somebody else’s code. You were probably expected to implement an algorithm to do your own sorting.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!