private File createZipFile(int entryCount,int entrySize) throws IOException {
  File result=createTemporaryZipFile();
  byte[] writeBuffer=new byte[8192];
  Random random=new Random();
  ZipOutputStream out=new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(result)));
  for (int entry=0; entry < entryCount; ++entry) {
    ZipEntry ze=new ZipEntry(Integer.toHexString(entry));
    out.putNextEntry(ze);
    for (int i=0; i < entrySize; i+=writeBuffer.length) {
      random.nextBytes(writeBuffer);
      int byteCount=Math.min(writeBuffer.length,entrySize - i);
      out.write(writeBuffer,0,byteCount);
    }
    out.closeEntry();
  }
  out.close();
  return result;
}

private File createZipFile ( int entryCount , int entrySize ) throws IOException { File result = createTemporaryZipFile ( ) ; byte [ ] writeBuffer = new byte [ 8192 ] ; Random random = new Random ( ) ; ZipOutputStream out = new ZipOutputStream ( new BufferedOutputStream ( new FileOutputStream ( result ) ) ) ; for ( int entry = 0 ; entry < entryCount ; ++ entry ) { ZipEntry ze = new ZipEntry ( Integer . toHexString ( entry ) ) ; out . putNextEntry ( ze ) ; for ( int i = 0 ; i < entrySize ; i += writeBuffer . length ) { random . nextBytes ( writeBuffer ) ; int byteCount = Math . min ( writeBuffer . length , entrySize - i ) ; out . write ( writeBuffer , 0 , byteCount ) ; } out . closeEntry ( ) ; } out . close ( ) ; return result ; }
compresses the given number of files , each of the given size , into a . zip archive .
