@@ -0,0 +1,1212 @@
+import java.io.FileReader;%0Aimport java.util.Objects;%0A%0Aimport com.google.gson.Gson;%0A%0Apublic class SelectionSort %7B%0A%0A%09public static void sort(int%5B%5D array) %7B%0A%09%09for (int i = 0; i %3C array.length; i++) %7B%0A%09%09%09// swap the array%5Bi%5D with min(array%5Bi+1:%5D)%0A%09%09%09int min = i;%0A%09%09%09for (int j = i + 1; j %3C array.length; j++) %7B%0A%09%09%09%09if (array%5Bmin%5D %3E array%5Bj%5D) %7B%0A%09%09%09%09%09min = j;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%09// swap a%5Bi%5D and a%5Bmin%5D:%0A%09%09%09int tmp = array%5Bi%5D;%0A%09%09%09array%5Bi%5D = array%5Bmin%5D;%0A%09%09%09array%5Bmin%5D = tmp;%0A%09%09%7D%0A%09%7D%0A%0A%09public static void main(String%5B%5D args) throws Exception %7B%0A%09%09SelectionSortInput%5B%5D inputs = new Gson().fromJson(new FileReader(%22selection-sort/input.json%22),%0A%09%09%09%09SelectionSortInput%5B%5D.class);%0A%09%09for (SelectionSortInput input : inputs) %7B%0A%09%09%09int%5B%5D array = new int%5Binput.array.length%5D;%0A%09%09%09System.arraycopy(input.array, 0, array, 0, array.length);%0A%09%09%09System.out.println(%22original =%3E %22 + new Gson().toJson(array));%0A%09%09%09sort(array);%0A%09%09%09System.out.println(%22sorted =%3E %22 + new Gson().toJson(array));%0A%09%09%09if (!Objects.deepEquals(array, input.result)) %7B%0A%09%09%09%09throw new Exception(%22failed. expected = %22 + new Gson().toJson(input.result) + %22, actual = %22%0A%09%09%09%09%09%09+ new Gson().toJson(array));%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%7D%0A%0Aclass SelectionSortInput %7B%0A%09int%5B%5D array;%0A%09int%5B%5D result;%0A%7D%0A

add selection sort java code