public static SecureNetworkBeacon createSecureNetworkBeacon(@NonNull final byte[] n,
                                                                final int flags,
                                                                @NonNull final byte[] networkId,
                                                                final int ivIndex) {
        final byte[] authentication = calculateAuthValueSecureNetBeacon(n, flags, networkId, ivIndex);

        final int inputLength = 1 + networkId.length + 4;
        final ByteBuffer pBuffer = ByteBuffer.allocate(inputLength);
        pBuffer.put((byte) flags);
        pBuffer.put(networkId);
        pBuffer.putInt(ivIndex);
        final ByteBuffer secNetBeaconBuffer = ByteBuffer.allocate(1 + inputLength + 8);
        secNetBeaconBuffer.put((byte) 0x01);
        secNetBeaconBuffer.put(pBuffer.array());
        secNetBeaconBuffer.put(authentication, 0, 8);
        return new SecureNetworkBeacon(secNetBeaconBuffer.array());
    }
Creates the secure network beacon

@param n         network key
@param flags     network flags, this represents the current state of hte network if key refresh/iv update is ongoing or complete
@param networkId unique id of the network
@param ivIndex   iv index of the network
mesh/src/main/java/no/nordicsemi/android/mesh/utils/SecureUtils.java