code: private static int printProgress(String str, long received,
        long advertisedSize, int lastPrinted) {
      if (advertisedSize == 0)
        return 0;
      int currentPercent = (int) ((received * 100) / advertisedSize);
      if (currentPercent != lastPrinted)
        FLOG.info("Downloading: " + str + ", completed: " + currentPercent);
      return currentPercent;
    }
docs: Print progress when downloading files.