### Question:
KHeap { public int popLE(double threshold) { int numPopped = 0; if (getWeight(0) <= threshold && additionalData != null) { numPopped = additionalData.size()/2; additionalData = null; } boolean popped = true; while (popped & size > 0 && getWeight(0) <= threshold) { popped = pop(); if (popped) { numPopped += 1; } } return numPopped; } KHeap(int maxSize);  KHeap(int maxSize, boolean extensible); boolean offer(final int id, final double weight); int size(); void dump(); long getId(final int i); double getWeight(final int i); int getExtensionSize(); boolean pop(); int popLE(double threshold);  }### Answer:
@Test public void testPopLE() { KHeap heap = new KHeap(3, true); heap.offer(1, 1); heap.offer(2, 2); heap.offer(3, 1); heap.offer(4, 1); heap.offer(5, 0); assertEquals(4, heap.size()); int numPopped = heap.popLE(0); assertEquals(0, numPopped); assertEquals(4, heap.size()); numPopped = heap.popLE(1d); assertEquals(3, numPopped); assertEquals(1, heap.size()); assertEquals(2d, heap.getWeight(0), 0d); }