La matriz de enteros y la matriz int intercambian la conversión mutua de List, Integer[], int[] en Java - Zhihu
Utilice la clase contenedora Integer[] nsndo={1,2,6,1,3};
Integer[] nsndo={1,2,6,1,3};
System.out.println(Arrays.toString(nsndo));
Arrays.sort(nsndo, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o2-o1;
}
});
System.out.println(Arrays.toString(nsndo));
Resultados de salida
[1, 2, 6, 1, 3]
[6, 3, 2, 1, 1]