title: Download percentage from file downloading in java
body: <p>I got this code for downloading my files:</p>
  
  <pre><code>public static void download()
              throws MalformedURLException, IOException
      {
          BufferedInputStream in = null;
          FileOutputStream out = null;
          try
          {
              in = new BufferedInputStream(new URL("https://www.dropbox.com/s/1uff8eeujplz4sf/files.zip?dl=1").openStream());
              out = new FileOutputStream(System.getProperty("user.home") + "/Adasti/files.zip");
              byte data[] = new byte[1024];
              int count;
  
              while ((count = in.read(data, 0, 1024)) != -1)
              {
                  out.write(data, 0, count);
              }
          } catch (MalformedURLException e1)
          {
              e1.printStackTrace();
          } catch (IOException e2)
          {
              e2.printStackTrace();
          } finally
          {
              if (in != null)
                  in.close();
              if (out != null)
                  out.close();
          }
      }
  </code></pre>
  
  <p>I want to print out the percentage of the download while its downloading. Is this possible with my method and if yes, how will I do it?</p>