mport java.util.Scanner;
import java.util.Arrays;

public class SortingExample {
    public static void main(String[] args) {
        Scanner myScanner = new Scanner(System.in);
        
        int[] original = new int[5];
        
        //get user input
        for (int i = 0; i < original.length; i++) {
            original[i] = myScanner.nextInt();
        }
        
        
        //sort it
        int[] sorted = sort(original);
        
        //print the result
        System.out.println("The original array: " + getString(original));
        System.out.println("The sorted array: " + getString(sorted));
    }
    
    static String getString(int[] array) {
        //start bracket
        String str = "{";
        
        //Add the fcontent of the array to the string
        for (int i = 0; i < array.length; i++) {
            //commas between the numbers
            if (i != 0) {
                str += ", ";
            }
            
            str += array[i];
        }
        
        //end bracket
        str += "}";
        return str;
    }
    
    static int[] sort(int[] numbers) {
        numbers = Arrays.copyOf(numbers, numbers.length);
        for (int i = 0; i < numbers.length; i++) {
            for (int j = numbers.length - 1; j > i; j--) {
                if (numbers[j] > numbers[j - 1]) {
                    //if the values are in the wrong order, swap them
                    swap(numbers, j, j - 1);
                }
            }         
        }
        
        return numbers;
    }
    
    static void swap(int[] array, int index1, int index2) {
        int temp = array[index1];
        array[index1] = array[index2];
        array[index2] = temp;
    }
}