public static boolean hasAllSegmentsBeenReceived(final Integer blockAcknowledgement, final int segN) {
        if (blockAcknowledgement == null)
            return false;
        MeshLogger.verbose(TAG, "Block ack: " + blockAcknowledgement);
        final int blockAck = blockAcknowledgement;
        int setBitCount = 0;
        for (int i = 0; i < segN; i++) {
            int bit = (blockAck >> i) & 1;
            if (bit == 1) {
                setBitCount++;
            }
        }
        MeshLogger.verbose(TAG, "bit count: " + setBitCount);
        return setBitCount == segN + 1; //Since segN is 0 based add 1 as the bit count represents the number of segments
    }
Checks if all segments are received based on the segment count

@param blockAcknowledgement acknowledgement payload received
@param segN                 number of segments
mesh/src/main/java/no/nordicsemi/android/mesh/control/BlockAcknowledgementMessage.java