title: Java calculate progress on UnZipping process
body: <p>I'm using an Unzipping process that I want to calculate its progress, here is the code with the counter:</p>
  
  <pre><code>float counter;
  @Override
  protected Boolean doInBackground(String... params) {
      try {
  
          String zipFile = Path + FileName;
  
          String unzipLocation = Path;
  
          FileInputStream fin = new FileInputStream(zipFile);
          ZipInputStream zin = new ZipInputStream(fin);
  
          ZipEntry ze = null;
          while ((ze = zin.getNextEntry()) != null) {
              counter++;
              if (ze.isDirectory()) {
                  dirChecker(ze.getName());
              } else {
                  FileOutputStream fout = new FileOutputStream(Path
                          + ze.getName());
                  while ((length = zin.read(buffer)) &gt; 0) {
                      fout.write(buffer, 0, length);                  
                  }
                  publishProgress((int)((counter/747.0)*100));
                  zin.closeEntry();
                  fout.close();
              }
  
          }
          zin.close();
      } catch (Exception e) {
          mProgressDialog.dismiss();
          return false;
      }
  
      return true;
      }
  
    @Override
  protected void onProgressUpdate(Integer... values) {
      mProgressDialog.setProgress(values[0]);
  }
  </code></pre>
  
  <p>I have only 1 .zip file which contains exactly 747 files... that why I use the number 747.<br>
  The problem is that values[0] is always 0 .. Am I calculating the process right? How should I do this? Thanks.</p>