import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
        System.out.println("Biblioteca");

        //Paso 2
        int [] prestamos = {8,12,6,10,14};
        int aux;
        
        //IMPRESIÓN del VECTOR.
        System.out.println("\nBiblioteca Desordenada");
        for(int x=0; x<prestamos.length; x++){
            System.out.print("\t" + prestamos[x]);
        }
        
        //Método de ordenamiento de estructura (Bubble Short)

        //
        for(int i=0;i<prestamos.length -1; i++){
            //
            for(int j=0;j<prestamos.length -1; j++){
               // 
               if(prestamos[j]<prestamos[j+1]){ //
                   //
                   aux = prestamos[j];
                   //
                   prestamos[j] = prestamos[j+1];
                   //
                   prestamos[j+1] = aux;
               } 
            }     
        }
        
        //IMPRESIÓN del VECTOR.
        System.out.println("\nBiblioteca Ordenada");
        for(int x=0; x<prestamos.length; x++){
            System.out.print("\t" + prestamos[x]);
        }

        
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: