The moose likes Beginning Java and the fly likes How to Sort an array in ascending order? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "How to Sort an array in ascending order?" Watch "How to Sort an array in ascending order?" New topic
Author

How to Sort an array in ascending order?

Rani Padmaja
Greenhorn

Joined: Feb 05, 2012
Posts: 2
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

Joined: Dec 10, 2008
Posts: 24
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
Sheriff

Joined: Oct 13, 2005
Posts: 26720
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

Joined: Oct 02, 2003
Posts: 8428

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.


Never ascribe to malice that which can be adequately explained by stupidity.
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 11642

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).


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Rani Padmaja
Greenhorn

Joined: Feb 05, 2012
Posts: 2
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
Sheriff

Joined: Oct 13, 2005
Posts: 26720
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.
 
 
subject: How to Sort an array in ascending order?
 
Threads others viewed
Simple program: NEED HELP!!
Reverse sort of array
array sorting
arrays?
socket programming
developer file tools