В идее все ок,а тут даже завершить работу не может в чем проблема?
package com.javarush.task.task31.task3106;
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
/*
Разархивируем файл
*/
public class Solution {
public static void main(String[] args) throws IOException {
int resultLength = 0;
for (String fileName : args) {
if(!fileName.equals(args[0])) {
FileInputStream fileInputStream = new FileInputStream(fileName);
while (fileInputStream.available() > 0) {
resultLength++;
}
fileInputStream.close();
}
}
byte[] bytes = new byte[resultLength];
int i = 0;
for (String fileName : args) {
if(!fileName.equals(args[0])) {
FileInputStream fileInputStream = new FileInputStream(fileName);
while (fileInputStream.available() > 0) {
bytes[i] = (byte) fileInputStream.read();
i++;
}
fileInputStream.close();
}
}
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
ZipInputStream zip = new ZipInputStream(byteArrayInputStream);
FileOutputStream fileOutputStream = new FileOutputStream(args[0]);
fileOutputStream.write(zip.read(bytes));
byteArrayInputStream.close();
zip.close();
fileOutputStream.close();
}
}