/******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Integer[] temperaturas = new Integer[23];
Scanner teclado = new Scanner( System.in );
for (int i = 0; i < 23; i++) {
System.out.print( "Ingrese las temperaturas " + i + ": " );
int tecla = teclado.nextInt();
temperaturas[i] = tecla;
}
Integer[] top5 = Arrays.stream( temperaturas )
.sorted( Comparator.reverseOrder() )
.limit( 5 )
.toArray( (i) -> new Integer[i] );
System.out.println( "El top 5 de temperaturas es: " + Arrays.toString( top5 ) );
}
}