class HugeIntArray extends HugeArray<int[], Integer, HugeIntArray> {

    public static long memoryEstimation(long size) {
        assert size >= 0;

        if (size <= ArrayUtil.MAX_ARRAY_LENGTH) {
            return sizeOfInstance(SingleHugeIntArray.class) + sizeOfIntArray((int) size);
        }
        long sizeOfInstance = sizeOfInstance(PagedHugeIntArray.class);

        int numPages = numberOfPages(size);

        long memoryUsed = sizeOfObjectArray(numPages);
        long pageBytes = sizeOfIntArray(PAGE_SIZE);
        memoryUsed += (numPages - 1) * pageBytes;
        int lastPageSize = exclusiveIndexOfPage(size);

        return sizeOfInstance + memoryUsed + sizeOfIntArray(lastPageSize);
    }

}