PreFillQueue generateAllocationOrder(PreFillType[] preFillSizes) {
        final int maxSize = memoryCache.getMaxSize() - memoryCache.getCurrentSize() + bitmapPool.getMaxSize();

        int totalWeight = 0;
        for (PreFillType size : preFillSizes) {
            totalWeight += size.getWeight();
        }

        final float bytesPerWeight = maxSize / (float) totalWeight;

        Map<PreFillType, Integer> attributeToCount = new HashMap<PreFillType, Integer>();
        for (PreFillType size : preFillSizes) {
            int bytesForSize = Math.round(bytesPerWeight * size.getWeight());
            int bytesPerBitmap = getSizeInBytes(size);
            int bitmapsForSize = bytesForSize / bytesPerBitmap;
            attributeToCount.put(size, bitmapsForSize);
        }

        return new PreFillQueue(attributeToCount);
    }
A class for pre-filling {@link Bitmap Bitmaps} in a
{@link BitmapPool}.
core/src/main/java/com/bumptech/glide/load/engine/prefill/BitmapPreFiller.java