sortuj bąbelki za pomocą wartości logicznej, aby określić, czy tablica jest już posortowana

Mam następujący kod do sortowania bąbelków, ale w ogóle nie sortuję. jeśli usunę moją wartość logiczną, to działa poprawnie. Rozumiem, że skoro mój [0] jest mniejszy niż wszystkie inne elementy, to żadna zamiana nie jest wykonywana, nikt nie może mi w tym pomóc.

package com.sample;

public class BubleSort {
    public static void main(String[] args) {
        int a[] = { 1, 2, 4, 5, 6, 88, 4, 2, 4, 5, 8 };
        a = sortBuble(a);
        for (int i : a) {
            System.out.println(i);
        }

    }

    private static int[] sortBuble(int[] a) {
        boolean swapped = true;
        for (int i = 0; i < a.length && swapped; i++) {
            swapped = false;
            System.out.println("number of iteration" + i);

            for (int j = i+1; j < a.length; j++) {

                if (a[i] > a[j]) {
                    int temp = a[i];
                    a[i] = a[j];
                    a[j] = temp;
                    swapped = true;
                }
            }
        }

        return a;
    }
}

questionAnswers(3)

yourAnswerToTheQuestion