could some one explain me how does sorting of a elements in java works? : i am beginner to java, i am confused about sorting of a elements in java, i am 
confused from the part "sorting begins"(commented section), could anyone kindly explain me.

    class endsly
    {
    public static void main(String[] args)
	{
		
    int num[]= {55,40,80,65,71};
    int n= num.length;

		System.out.println("Given list:   ");
		for(int i=0;i<n;i++)
		{
			System.out.println("  " + num[i]);
		}
		System.out.println("\n");
		
	//sorting begins
		
		for(int i=0;i<n;i++)
		{
			for(int j=i+1;j<n;j++)
			{
				
				if(num[i]<num[j])
				{
					int temp=num[i];
					num[i]=num[j];
					num[j]=temp;
				}
				}
		}
		System.out.println("Sorted list:");
		for(int i=0;i<n;i++)
		{
			System.out.println("  " + num[i]);
		}
		System.out.println("  ");
    }
    }
	