public void sort(int[] array)
  {
    int length = array.length;

    for (int gap : gaps)
    {
      for (int i = 0; i < length; i++)
      {
        int temp = array[i],
            j = i;
        for (; j >= gap && array[j - gap] > temp; j -= gap)
          array[j] = array[j - gap];

        array[j] = temp;
      }
    }
  }