title: Retain original modified timestamp while replacing the new file into the jar file
body: <p>I am replacing a file into the existing jar file using the java. While i am replacing the new file, remaining files modified time also changing to current timestamp. Please advise what need to do retain the original modified datetime for the other files. I am using the code,</p>
  
  <pre><code>    while (entry != null) {
          String name = entry.getName();
          boolean notInFiles = true;
          for (File f : files) {
              if (f.getName().equals(name)) {
                  notInFiles = false;
                  break;
              }
          }
                      if (notInFiles) {
              // Add ZIP entry to output stream.
              out.putNextEntry(new ZipEntry(name));
              // Transfer bytes from the ZIP file to the output file
              int len;
              while ((len = zin.read(buf)) &gt; 0) {
                  out.write(buf, 0, len);
              }
          }
          entry = zin.getNextEntry();
      }
      // Close the streams        
      zin.close();
      // Compress the files
      for (int i = 0; i &lt; files.length; i++) {
          InputStream in = new FileInputStream(files[i]);
          // Add ZIP entry to output stream.
          out.putNextEntry(new ZipEntry(files[i].getName()));
          // Transfer bytes from the file to the ZIP file
          int len;
          while ((len = in.read(buf)) &gt; 0) {
              out.write(buf, 0, len);
          }
          // Complete the entry
          out.closeEntry();
          in.close();
      }
  </code></pre>