@@ -0,0 +1,1040 @@
+import java.io.*;%0Aimport java.util.*;%0A%0Apublic class Solution %7B%0A    %0A    public static void swap(int%5B%5D a, int i, int j)%7B%0A        int x = a%5Bi%5D;%0A        a%5Bi%5D = a%5Bj%5D;%0A        a%5Bj%5D = x;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Scanner scanner = new Scanner(System.in);%0A        int n = scanner.nextInt();scanner.nextLine();%0A        int%5B%5D a = new int%5Bn%5D;%0A        for (int idx=0; idx %3C n; idx++) %7B%0A            a%5Bidx%5D = scanner.nextInt();%0A        %7D%0A        %0A        int numberOfSwaps = 0;        %0A        for (int i = 0; i %3C n; i++) %7B%0A            for (int j = 0; j %3C n - 1; j++) %7B%0A                if (a%5Bj%5D %3E a%5Bj + 1%5D) %7B%0A                    swap(a, j, (j + 1));%0A                    numberOfSwaps++;%0A                %7D%0A            %7D%0A            if (numberOfSwaps == 0) %7B%0A                break;%0A            %7D%0A        %7D        %0A        %0A        System.out.format(%22Array is sorted in %25d swaps.%25n%22, numberOfSwaps);%0A        System.out.format(%22First Element: %25d%25n%22, a%5B0%5D);%0A        System.out.format(%22Last Element: %25d%25n%22, a%5Bn-1%5D);%0A%0A    %7D%0A%7D%0A

Create Day_20_Sorting.java