please help me out to understanding this array sorting (bubble sort) : how did it working when both the loop is starting from 0 and comparison between both indexes have the same value

    public class BubbleSort {
    public static void main(String[] args)
    {
    int arr[]={5,1,2,1,1,4,4,4,4,4,3};
    
    for(int i=0;i<arr.length;i++)//i=0
    {
        for(int j=0;j<arr.length;j++)//j=0
        {
            if(arr[i]>arr[j])//i=5>j=5
            {
               int temp=arr[i];
               arr[i]=arr[j];
               arr[j]=temp;
            }
        }
    
    }
        
    
        for(int k=0;k<arr.length;k++)` `
        System.out.println(arr[k]);
    
    }
}