Refactored Binary Heap in Java compare method.