code: @SuppressWarnings("WeakerAccess")
      public int floorSum(long sum) {
          int floor = IntAVLTree.NIL;
          for (int node = tree.root(); node != IntAVLTree.NIL; ) {
              final int left = tree.left(node);
              final long leftCount = aggregatedCounts[left];
              if (leftCount <= sum) {
                  floor = node;
                  sum -= leftCount + count(node);
                  node = tree.right(node);
              } else {
                  node = tree.left(node);
              }
          }
          return floor;
      }
docs: Return the last node so that the sum of counts of nodes that are before
  it is less than or equal to <code>sum</code>.