public static void sort(int[] array) {
    printArray(array);
    int a = 0;
    boolean finished = true;
    for (int i = 0; i < array.length; i++) {
      finished = true;
        for (int j = i % 2; j < array.length - 1 - i % 2; j += 2) {
          if(array[j] > array[j + 1]) {
            a = array[j + 1];
            array[j + 1] = array[j];
            array[j] = a;
            finished = false;
          }
        }
      if(finished) {
        break;
      }
      printArray(array);
    }
    printArray(array);
  }