private int computeBuffersSize(int numberOfMipmapLevels, int pixelWidth, int pixelHeight, int bytePerPixel, int pixelDepth) {
        int byteBuffersSize = 0;
        for (int mipLevel = 0; mipLevel < numberOfMipmapLevels; mipLevel++) {
            int width = Math.max(1, pixelWidth >> mipLevel);
            int height = Math.max(1, pixelHeight >> mipLevel);
            byteBuffersSize += width * height * bytePerPixel;
            log.log(Level.FINE, "mip level size : {0} : {1}", new Object[]{mipLevel, width * height * bytePerPixel});
        }
        return byteBuffersSize * pixelDepth;
    }
Computes a buffer size from given parameters
@param numberOfMipmapLevels 
@param pixelWidth
@param pixelHeight
@param bytePerPixel
@param pixelDepth
@return
jme3-core/src/plugins/java/com/jme3/texture/plugins/ktx/KTXLoader.java