楼主看一下api文档就可以了,要从大到小应该是要把int转成Integer才行的吧 static void sort(byte[] a) Sorts the specified array of bytes into ascending numerical order. static void sort(byte[] a, int fromIndex, int toIndex) Sorts the specified range of the specified array of bytes into ascending numerical order. static void sort(char[] a) Sorts the specified array of chars into ascending numerical order. static void sort(char[] a, int fromIndex, int toIndex) Sorts the specified range of the specified array of chars into ascending numerical order. static void sort(double[] a) Sorts the specified array of doubles into ascending numerical order. static void sort(double[] a, int fromIndex, int toIndex) Sorts the specified range of the specified array of doubles into ascending numerical order. static void sort(float[] a) Sorts the specified array of floats into ascending numerical order. static void sort(float[] a, int fromIndex, int toIndex) Sorts the specified range of the specified array of floats into ascending numerical order. static void sort(int[] a) Sorts the specified array of ints into ascending numerical order. static void sort(int[] a, int fromIndex, int toIndex) Sorts the specified range of the specified array of ints into ascending numerical order. static void sort(long[] a) Sorts the specified array of longs into ascending numerical order. static void sort(long[] a, int fromIndex, int toIndex) Sorts the specified range of the specified array of longs into ascending numerical order. static void sort(Object[] a) Sorts the specified array of objects into ascending order, according to the natural ordering of its elements. static void sort(Object[] a, int fromIndex, int toIndex) Sorts the specified range of the specified array of objects into ascending order, according to the natural ordering of its elements. static void sort(short[] a) Sorts the specified array of shorts into ascending numerical order. static void sort(short[] a, int fromIndex, int toIndex) Sorts the specified range of the specified array of shorts into ascending numerical order. static <T> void sort(T[] a, Comparator<? super T> c) Sorts the specified array of objects according to the order induced by the specified comparator. static <T> void sort(T[] a, int fromIndex, int toIndex, Comparator<? super T> c) Sorts the specified range of the specified array of objects according to the order induced by the specified comparator.
import java.util.*;public class Reverse { public static void main(String args[]){ int a[] = new int[5]; Integer aa[] = new Integer[a.length]; Random rnd = new Random(); for(int i=0; i<a.length; i++){ a[i] = rnd.nextInt(); aa[i] = new Integer(a[i]); }
static void sort(byte[] a)
Sorts the specified array of bytes into ascending numerical order.
static void sort(byte[] a, int fromIndex, int toIndex)
Sorts the specified range of the specified array of bytes into ascending numerical order.
static void sort(char[] a)
Sorts the specified array of chars into ascending numerical order.
static void sort(char[] a, int fromIndex, int toIndex)
Sorts the specified range of the specified array of chars into ascending numerical order.
static void sort(double[] a)
Sorts the specified array of doubles into ascending numerical order.
static void sort(double[] a, int fromIndex, int toIndex)
Sorts the specified range of the specified array of doubles into ascending numerical order.
static void sort(float[] a)
Sorts the specified array of floats into ascending numerical order.
static void sort(float[] a, int fromIndex, int toIndex)
Sorts the specified range of the specified array of floats into ascending numerical order.
static void sort(int[] a)
Sorts the specified array of ints into ascending numerical order.
static void sort(int[] a, int fromIndex, int toIndex)
Sorts the specified range of the specified array of ints into ascending numerical order.
static void sort(long[] a)
Sorts the specified array of longs into ascending numerical order.
static void sort(long[] a, int fromIndex, int toIndex)
Sorts the specified range of the specified array of longs into ascending numerical order.
static void sort(Object[] a)
Sorts the specified array of objects into ascending order, according to the natural ordering of its elements.
static void sort(Object[] a, int fromIndex, int toIndex)
Sorts the specified range of the specified array of objects into ascending order, according to the natural ordering of its elements.
static void sort(short[] a)
Sorts the specified array of shorts into ascending numerical order.
static void sort(short[] a, int fromIndex, int toIndex)
Sorts the specified range of the specified array of shorts into ascending numerical order.
static <T> void
sort(T[] a, Comparator<? super T> c)
Sorts the specified array of objects according to the order induced by the specified comparator.
static <T> void
sort(T[] a, int fromIndex, int toIndex, Comparator<? super T> c)
Sorts the specified range of the specified array of objects according to the order induced by the specified comparator.
public static void main(String args[]){
int a[] = new int[5];
Integer aa[] = new Integer[a.length];
Random rnd = new Random();
for(int i=0; i<a.length; i++){
a[i] = rnd.nextInt();
aa[i] = new Integer(a[i]);
}
Arrays.sort(aa,Collections.reverseOrder());
for(int i=0; i<a.length; i++){
System.out.println(aa[i]);
}
}
}