private static int calculateFrameLength(int layer, int bitRate, int sampleRate, int padding) {
        if (layer == AudioFrame.LAYER_1) {
            return (12 * bitRate / sampleRate + padding) * 4;
        } else {
            return 144 * bitRate / sampleRate + padding;
        }
    }
Calculates the length of an MPEG frame based on the given parameters.

@param layer      the layer
@param bitRate    the bit rate
@param sampleRate the sample rate
@param padding    the padding flag
@return the length of the frame in bytes
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/java/org/apache/tika/parser/mp3/MpegStream.java