@@ -0,0 +1,1488 @@
+/*%0A * To change this license header, choose License Headers in Project Properties.%0A * To change this template file, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage bubblesort;%0A%0Aimport java.util.Arrays;%0Aimport java.util.Random;%0A%0A/**%0A *%0A * @author Dante%0A */%0Apublic class Bubblesort %7B%0A%0A    /**%0A     * @param args the command line arguments%0A     */%0A    public static void main(String%5B%5D args) %7B%0A        // TODO code application logic here %0A        int%5B%5D array = populateArr(15);%0A%0A        //not sorted%0A        System.out.println(Arrays.toString(array));%0A        //sorted%0A        bubbleSort(array);%0A        System.out.println(Arrays.toString(array));%0A%0A    %7D%0A%0A    public static void bubbleSort(int%5B%5D arr) %7B%0A        int n = arr.length; %0A        %0A        for (int i = 0; i %3C n; i++) %7B%0A            //continua fino alla fine dell'array disordinato%0A            for (int j = 1; j %3C (n - i); j++) %7B%0A                //esegue uno scambio semplice%0A                if (arr%5Bj - 1%5D %3E arr%5Bj%5D) %7B%0A                    swap(arr,  j-1, j); %0A                %7D%0A            %7D%0A        %7D %0A    %7D%0A%0A    public static void swap(int%5B%5D arr, int a, int b) %7B%0A        int temp;%0A        %0A        temp = arr%5Ba%5D;%0A        arr%5Ba%5D = arr%5Bb%5D;%0A        arr%5Bb%5D = temp;%0A    %7D%0A    %0A    private static int%5B%5D populateArr(int n)%7B%0A%09%09%0A%09    int%5B%5D sort = new int%5Bn%5D;%0A%09    Random random = new Random();%0A%09    for (int i = 0; i %3C sort.length; i++) %7B%0A%09%09    sort%5Bi%5D = random.nextInt(n * 10);%0A%09    %7D%0A%09%0A%09    return sort;%0A%09%7D%0A%0A%7D%0A

Create BubbleSort.java