code: boolean archiveFile(File logFile) {
  
  		FileOutputStream fOut;
  		ZipOutputStream zOut;
  
  		// necessary because of possible IOException
  		try {
  			fOut = new FileOutputStream(logFile.getPath() + ".zip");
  			zOut = new ZipOutputStream(fOut);
  
  			FileInputStream fIn = new FileInputStream(logFile);
  			BufferedInputStream bIn = new BufferedInputStream(fIn);
  
  			// new ZipEntry to put into the archive
  			ZipEntry entry = new ZipEntry(logFile.getCanonicalFile().getName());
  			zOut.putNextEntry(entry);
  
  			// create a byte array
  			byte[] barray = new byte[1024];
  			// byte count variable
  			int bytes;
  
  			// read the BufferedInputStream and write it entirely to the archive
  			while ((bytes = bIn.read(barray, 0, 1024)) > -1) {
  				zOut.write(barray, 0, bytes);
  			}
  
  			// clean up
  			zOut.flush();
  			zOut.close();
  			fOut.close();
  
  			return true;
  
  		} catch (IOException ioE) {
  			return false;
  		}
  
  	}
docs: archive log file