aspose file tools*
The moose likes Beginning Java and the fly likes sorting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "sorting" Watch "sorting" New topic
Author

sorting

terry oliver
Greenhorn

Joined: Jan 04, 2008
Posts: 22
what is the best way to sort three double variables in ascending order

thanks Olly
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

Depends what your definition of best is. Also, you must consider what to do when any of the doubles is NaN - that will not compare to anything.

Fast method:

There is a more generic method however, for any number of (non-NaN) numbers:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
arulk pillai
Author
Ranch Hand

Joined: May 31, 2007
Posts: 3274
SCJP 1.4 100%


Good stuff.


500+ Java Interview Questions and Answers | Java job hunting know how & Java resumes
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

Thank you. I think I got lucky on a few questions though.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sorting