Dway heaps (Java)