Sortierroutine für Bubblesort

static void sort(double[] a) {
  boolean nochmal = true;
    
  while (nochmal) {
    // laufe solange durch das Array, bis keine Vertauschungen mehr nötig waren
    nochmal = false;
    for (int i = 0; i < a.length - 1; i++) {
      if (a[i] > a[i + 1]) {
        vertausche(a, i, i + 1);
        nochmal = true;
      }
    }
  }
}
   
static void vertausche(double[] a, int i, int j) {
  // vertausche a[i] und a[j]
  double temp = a[i];
  a[i] = a[j];
  a[j] = temp;
}