class HugeSparseLongArray {

    public static MemoryRange memoryEstimation(long maxId, long maxEntries) {
        assert(maxEntries <= maxId);
        int numPagesForSize = PageUtil.numPagesFor(maxId, PAGE_SHIFT, PAGE_MASK);
        int numPagesForMaxEntriesBestCase = PageUtil.numPagesFor(maxEntries, PAGE_SHIFT, PAGE_MASK);

        // Worst-case distribution assumes at least one entry per page
        final long maxEntriesForWorstCase = Math.min(maxId, maxEntries * PAGE_SIZE);
        int numPagesForMaxEntriesWorstCase = PageUtil.numPagesFor(maxEntriesForWorstCase, PAGE_SHIFT, PAGE_MASK);

        long classSize = MemoryUsage.sizeOfInstance(HugeSparseLongArray.class);
        long pagesSize = MemoryUsage.sizeOfObjectArray(numPagesForSize);
        long minRequirements = numPagesForMaxEntriesBestCase * PAGE_SIZE_IN_BYTES;
        long maxRequirements = numPagesForMaxEntriesWorstCase * PAGE_SIZE_IN_BYTES;
        return MemoryRange.of(classSize + pagesSize).add(MemoryRange.of(minRequirements, maxRequirements));
    }

    private  HugeSparseLongArray(long capacity, long[][] pages, long defaultValue);

}