import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
        int[] arr=new int[5];
        arr[0]=4;
        arr[1]=1;
        arr[2]=3;
        arr[3]=9;
        arr[4]=2;
        //int j=0;
            
        for(int i=1;i<5;i++){
            int j=i;
           while( j>=1 && (arr[j-1]>arr[j])){
               int temp=arr[j-1];
               arr[j-1]=arr[j];
               arr[j]=temp;
               j--;
           }
        }
        for(int i=0;i<5;i++){
            System.out.println(arr[i]);
        }
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: