ArrayLists and While Loops

I need help (obviously), with sorting data in an arraylist into largest-first order. Any help ? I need a while/loop or something like, to sort through the ArrayList and to find the largest the number and return it / store it into a field.
[245 byte] By [SM-Neta] at [2007-10-2 11:28:57]
# 1
Take a look at the API docs for Collections: http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.htmlIt sounds like methods sort and/or max do what you need. Have a go.
Lokoa at 2007-7-13 4:48:42 > top of Java-index,Core,Core APIs...
# 2

If you're just going to find the max, there's no need to sort. Just iterate over the list, keeping track of the largest so far.

If you do need to actually have the list sorted, then look at Collections.sort, or put the values into a SortedSet.

http://java.sun.com/docs/books/tutorial/collections/

[url=http://www.onjava.com/lpt/a/3286]Making Java Objects Comparable[/url]

http://java.sun.com/docs/books/tutorial/collections/interfaces/order.html

http://www.javaworld.com/javaworld/jw-12-2002/jw-1227-sort.html

jverda at 2007-7-13 4:48:42 > top of Java-index,Core,Core APIs...