code: private static int notifyProgress(UploadProgress notifier, File file, int bytesWritten, int bytesTotal, int prevPct) {
          if (notifier != null) {
              int pct = (int) ((bytesWritten * 100L) / bytesTotal);
              
              // We don't want to inform about the same pct twice
              if (prevPct != pct) {
                  notifier.uploadProgress(file, bytesTotal, pct);
                  return pct;
              }
              return prevPct;
          }
          return prevPct;
      }
docs: Utility method