code: private void store(PriorityQueue<Entry> queue)
      {
          nextIndex = 0;
          for (Entry entry : queue) {
              if (entry.isValid()) {
                  values[nextIndex] = entry.getValue();
                  weights[nextIndex] = entry.getWeight();
                  nextIndex++;
              }
          }
          sort(values, weights, nextIndex);
      }
docs: Dump the entries in the queue back into the bucket arrays
  The values are guaranteed to be sorted in increasing order after this method completes