Int[] A = new Int[10];for (int i = 0; i < a.length; i++) {A[i] = random (); System.out.print (A[i] + "");} SYSTEM.OUT.PRINTLN (); int temp = 0;//Small to large//simple selection sorting Method//Method 1int Minindex = 0;for (int i = 0; i < a.length-1; i++) {MinIn Dex = i;for (int j = i + 1; j < A.length; J + +) {if (A[j] < A[minindex]) {minindex = j;} if (minindex! = i) {temp = A[i];a[i] = A[minindex];a[minindex] = temp;}}} System.out.println (); for (int x:a) {System.out.print (x + "");} Method 2for (int i = 0; i < a.length-1; i++) {for (int j = i + 1; j < A.length; J + +) {if (A[i] > A[j]) {temp = a[ I];a[i] = a[j];a[j] = temp;}}} System.out.println ("Small to Large value:"), for (int i = 0; i < a.length; i++) {System.out.print (A[i] + "");} The bubbling algorithm Boolean swapped = true;for (int i = 1; swapped && i <= a.length-1; i++) {swapped = false;for (int j = 0; J < A.length-i; J + +) {if (A[j] > a[j + 1]) {temp = A[j];a[j] = a[j + 1];a[j + 1] = Temp;swapped = True;}}} for (int x:a) {System.out.print (x + ""));}}
Sorting algorithm (simple sort, bubbling sort)