How to order a Vector added?

Let's say i hav this point system where i retrieved value from the DB and add the points. let's say

the code is:

int x = 0;

int total = 0;

while(x < vVector.size())

{

total = Integer.parseInt(String.valueOf(vVector.get(x))) + Integer.parseInt(String.valueOf(vVector.get(x+1)));

vPoints.addElement(total); x = x + 2;

}

From the vector vPoints, i want to order all the values that i got and display the 5 highest values.

How do i order the values in ascending or descending?

[696 byte] By [jonasdavedomingo] at [2007-9-30 17:22:38]
# 1
Collections.sort.
nasch_ at 2007-7-6 13:45:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
so u mean the code is vPoints.sortwhat if i want to sort it descending order?
jonasdavedomingo at 2007-7-6 13:45:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
iv tried the codes 1. vPoints.sort;2. vPoints.sort();both didnot work!
jonasdavedomingo at 2007-7-6 13:45:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
anyone knows how? pls help!
jonasdavedomingo at 2007-7-6 13:45:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Not vector.sort, [url=http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collections.html]Collections[/url].[url=http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collections.html#sort(java.util.List)]sort(List v)[/url]

To reverse the order, use: [url=http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collections.html]Collections[/url].[url=http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collections.html#reverse(java.util.List)]reverse(List l)[/url]

stevejluke at 2007-7-6 13:45:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...