protected String checkHeap() {
    for(int i = 1; i < size; i++) {
      final int parent = (i - 1) >>> 1;
      if(comparator.compare(queue[parent], queue[i]) > 0) {
        return "@" + parent + ": " + queue[parent] + " < @" + i + ": " + queue[i];
      }
    }
    return null;
  }
protected String checkHeap ( ) { for ( int i = 1 ; i < size ; i ++ ) { final int parent = ( i - 1 ) > > > 1 ; if ( comparator . compare ( queue [ parent ] , queue [ i ] ) > 0 ) { return "@" + parent + ": " + queue [ parent ] + " < @" + i + ": " + queue [ i ] ; } } return null ; }
Test whether the heap is still valid.

Debug method.

@return {@code null} when the heap is correct