user84187: I tried to use the following code:
    DeterministicKey key = DeterministicKey.deserializeB58(null , "xpub...", MAINNET);



    DeterministicHierarchy hierarchy = new DeterministicHierarchy(key)
;
    DeterministicKey chain = hierarchy.deriveChild(key.getPath(), false, false, new ChildNumber(0, false));
    DeterministicKey index = hierarchy.deriveChild(chain.getPath(), false, false, new ChildNumber(0, false));
    SegwitAddress segwitAddress = SegwitAddress.fromHash(MAINNET, index.getPubKeyHash());

But it doesn't return correct address. 
Any help here

user66391: Zpub's would be needed for native segwit addresses. And current bitcoinj master branch does not support Zpub, it support xpub and xpub's would always derive to
legacy addresses. Give a try to Segwit branch that may helps. Also take a look at this

84187: <p>I tried to use the following code:</p>

<pre><code>    DeterministicKey key = DeterministicKey.deserializeB58(null , "xpub...", MAINNET);



    DeterministicHierarchy hierarchy = new DeterministicHierarchy(key)
;
    DeterministicKey chain = hierarchy.deriveChild(key.getPath(), false, false, new ChildNumber(0, false));
    DeterministicKey index = hierarchy.deriveChild(chain.getPath(), false, false, new ChildNumber(0, false));
    SegwitAddress segwitAddress = SegwitAddress.fromHash(MAINNET, index.getPubKeyHash());
</code></pre>

<p>But it doesn't return correct address. 
Any help here</p>
 66391: <p>Zpub's would be needed for native segwit addresses. And current bitcoinj master branch does not support Zpub, it support xpub and xpub's would always derive to
legacy addresses. Give a try to Segwit branch that may helps. Also take a look at <a href="https://github.com/bitcoinj/bitcoinj/pull/1563" rel="nofollow noreferrer">this</a></p>
