How to download blk.dat files from a specific block number? I want to download blk.dat of a specific block number, How can I do this ?

Note: I'm only interested in specific blocks, I only want to download blocks for example that are numbered between 100 and 200,etc...
I see two broad solutions:
Use an API that allows you to get blocks by block height
BlockChain.info allows you to query for blocks at a certain height. Example:
https://blockchain.info/block-height/100?format=json

returns
{ &quot;blocks&quot; : [
{
    &quot;hash&quot;:&quot;000000007bc154e0fa7ea32218a72fe2c1bb9f86cf8c9ebf9a715ed27fdb229a&quot;,
    &quot;ver&quot;:1,
(snipped)

(Remember to filter out blocks that aren't on the main chain, by looking at the &quot;main_chain&quot; attribute.)
You can take that hash, and look up the block:
https://blockchain.info/rawblock/000000007bc154e0fa7ea32218a72fe2c1bb9f86cf8c9ebf9a715ed27fdb229a

returns
{
    &quot;hash&quot;:&quot;000000007bc154e0fa7ea32218a72fe2c1bb9f86cf8c9ebf9a715ed27fdb229a&quot;,
    &quot;ver&quot;:1,    
    &quot;prev_block&quot;:&quot;00000000cd9b12643e6854cb25939b39cd7a1ad0af31a9bd8b2efe67854b1995&quot;,
    &quot;mrkl_root&quot;:&quot;2d05f0c9c3e1c226e63b5fac240137687544cf631cd616fd34fd188fc9020866&quot;,
    &quot;time&quot;:1231660825,
(snipped)

(This is in a JSON format custom to BlockChain - I haven't found any API providers that will return the raw block. Kinda annoying.)
Write a client that gets the blocks from the network
This downloads the headers of the Bitcoin blockchain (much smaller than the whole blockchain). Then, it goes through the block headers and downloads the ones you want.
WalletAppKit kit = new WalletAppKit(MainNetParams.get(), new java.io.File(&quot;.&quot;), &quot;test&quot;);
// Download headers
kit.startAndWait();
BlockChain chain = kit.chain();
BlockStore bs = chain.getBlockStore();
Peer peer = kit.peerGroup().getDownloadPeer();
// Get last block
StoredBlock current = bs.getChainHead();
// Loop until you reach the genesis block
while(current.getHeight() &gt; 1) {
    // Fully download blocks between 100 and 200
    if(100 &lt;= current.getHeight() &amp;&amp; current.getHeight() &lt;= 200) {
        Block b = peer.getBlock(current.getHeader().getHash()).get();
        System.out.println(b);
    }
    current = current.getPrev(bs);
}

This example uses BitcoinJ, but other SPV Bitcoin libraries can do this too.
(Thanks to Diego Basch for the code.)