title: Downloading a region of a file using java
body: <p>I am trying to download a file using java. In order to provide maximum speed, I want to download the files as separate regions. I can use the  following code.</p>
  
  <pre><code>// Specify what portion of file to download.
  connection.setRequestProperty("Range", "bytes=" + downloaded + "-");
  </code></pre>
  
  <p>But, with this I can start the download from the point X. What actually want is to download in-between regions separately. Say I have to download a file 1024 Bytes file, then I want to download the regions as 0-340 Bytes as section 1, 341 - 680 as section 2 and 681 - 1024 as the section 3.</p>
  
  <p>How can I specify the range with interim values ?</p>
  
  <p>Thanks in advance. </p>