user134304: Bech32 addresses start with bc1 on the main net and tb1 on the test net.
I want to know whether a segwit address is valid or not.
How can I check that segwit addresses are correctly inserted?

user135945: Bitcoin core command to validate an address: https://developer.bitcoin.org/reference/rpc/validateaddress.html

user5406: Bech32 is specified in BIP173. Native segwit outputs version 0 (P2WPKH and P2WSH) use bech32 addresses.
Native segwit outputs version 1+ (P2TR) use the improved bech32m for their addresses. Bech32m is specified in BIP350.
Besides the specifications the BIPs contain test vectors which should be deployed in their entirety to verify any implementation.
A Java implementation of bech32(m) addresses can be found here in bitcoinj.

134304: <p>Bech32 addresses start with <code>bc1</code> on the main net and <code>tb1</code> on the test net.
I want to know whether a segwit address is valid or not.
How can I check that segwit addresses are correctly inserted?</p>
 135945: <p>Bitcoin core command to validate an address: <a href="https://developer.bitcoin.org/reference/rpc/validateaddress.html" rel="nofollow noreferrer">https://developer.bitcoin.org/reference/rpc/validateaddress.html</a></p>
 5406: <p>Bech32 is specified in <a href="https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki" rel="nofollow noreferrer">BIP173</a>. Native segwit outputs version 0 (P2WPKH and P2WSH) use bech32 addresses.
Native segwit outputs version 1+ (P2TR) use the improved bech32m for their addresses. Bech32m is specified in <a href="https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki" rel="nofollow noreferrer">BIP350</a>.</p>
<p>Besides the specifications the BIPs contain test vectors which should be deployed in their entirety to verify any implementation.</p>
<p>A Java implementation of bech32(m) addresses can be found here in <a href="https://github.com/bitcoinj/bitcoinj/blob/44d0576ce4310a3d6f1859964e391fa8d981d409/core/src/main/java/org/bitcoinj/base/Bech32.java" rel="nofollow noreferrer">bitcoinj</a>.</p>
