I want to sort it by not using Array sorting.
import java.util.Scanner;
public class practice5 {
public static void main(String[] args) {
Scanner p = new Scanner(System.in);
int i,j,temp = 0;
int min=0, max=0;
String w;
System.out.print("Enter a Number to sort:"); w = p.nextLine();
String[] m = w.split("\\s+");
int [] a = new int[m.length];
for ( i = 0; i<m.length; i++)
{
a[i] = Integer.parseInt(m[i]);
}
for(i=0; i<a.length-1; i ++){
for (j=0; j<a.length-i-1; j++){
if (a[j]>a[j+1])
{
temp = a[j+1];
a[j+1] = a[j];
a[j] = temp;
}
}
}
for (i = 0; i<a.length;i++)System.out.print(a[i] + " ");
}
It is sorting but i want to show the sorting by step by step proccess for example:
Number inputed is : 3 2 1
1st sort is : 2 3 1
2nd sort is : 2 1 3
Last sort is : 1 2 3
Thanks in advance :) i know there's a missing code in my code but i tried several things but i still can't get it