Not doing the sort

I don’t know why it is sorting…
Code:
package Array;

public class Sorting_Techniques {

public static void main(String[] args) {
	// TODO Auto-generated method stub
	int[] a = {66,55,22,44};
	BubbleSort(a);
	display(a);
}
public static void BubbleSort(int arr[])
{
	for(int c = 0; c < arr.length  ;c++)
	{
		for(int j =0 ; j < arr.length - 1- c;j++)
		{
			if(arr[j] > arr[j+1])
			{
				int temp = arr[j];
				arr[j] = arr[j];
				arr[j+1] = temp;
			}
		}
	}
}
public static void display(int arr[])
{
	for(int i= 0 ;i< arr.length; i++)
	{
		System.out.print(" "+arr[i]);
	}
}

}

Hey @bharath_gopishetti,
You made an error while swapping
You wrote,

int temp = arr[j];
arr[j] = arr[j];
arr[j+1] = temp;

But it should be

int temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;

Rest of the code looks good.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.