@@ -0,0 +1,2202 @@
+import java.io.*;%0Aimport java.util.zip.Deflater;%0Aimport java.util.zip.ZipEntry;%0Aimport java.util.zip.ZipOutputStream;%0A%0A/**%0A * Created with IntelliJ IDEA.%0A * User: pylkevych%0A * Date: 9/8/14%0A * Time: 7:19 PM%0A * To change this template use File %7C Settings %7C File Templates.%0A */%0Apublic class Archive %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        try %7B%0A            FileOutputStream fos = new FileOutputStream(%22test.zip%22);%0A            ZipOutputStream zos = new ZipOutputStream(fos);%0A%0A            String path = %22/home/pylkevych/SQA_training/HomeWork_2/%22;%0A            String files;%0A            File folder = new File(path);%0A            File%5B%5D listOfFiles = folder.listFiles();%0A%0A            genTextFiles(100);%0A%0A            for (int i = 0; i %3C listOfFiles.length; i++) %7B%0A                if (listOfFiles%5Bi%5D.isFile()) %7B%0A                    files = listOfFiles%5Bi%5D.getName();%0A                    if (files.toLowerCase().endsWith(%22.txt%22)) %7B%0A                        addToZipFile(listOfFiles%5Bi%5D, zos);%0A                    %7D%0A                %7D%0A            %7D%0A            zos.close();%0A            fos.close();%0A        %7D catch (FileNotFoundException e) %7B%0A            e.printStackTrace();%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A        %7D%0A%0A    %7D%0A%0A    public static void addToZipFile(File file, ZipOutputStream zos) throws IOException %7B%0A        System.out.println(%22Writing '%22 + file.getName() + %22' to zip file%22);%0A%0A        FileInputStream fis = new FileInputStream(file);%0A        ZipEntry zipEntry = new ZipEntry(file.getName());%0A        zos.putNextEntry(zipEntry);%0A        zos.setLevel(Deflater.BEST_SPEED);%0A%0A        byte%5B%5D bytes = new byte%5B1024%5D;%0A        int length;%0A        while ((length = fis.read(bytes)) %3E= 0) %7B%0A            zos.write(bytes, 0, length);%0A        %7D%0A        zos.closeEntry();%0A        fis.close();%0A    %7D%0A%0A    public static void genTextFiles(int count) %7B%0A        try %7B%0A            for(int i = 1; i %3C= count; i++) %7B%0A            File file = new File(i + %22.txt%22);%0A            FileWriter writer = new FileWriter(file);%0A            writer.flush();%0A            writer.close();%0A            %7D%0A        %7D catch (IOException e) %7B%0A            System.out.println(e);%0A        %7D%0A    %7D%0A%7D%0A

Create Archive.java