private void generateFile(int wordCnt) throws Exception {
  Random rnd=new Random(System.currentTimeMillis());
  try (OutputStreamWriter writer=new OutputStreamWriter(igfs.create(FILE,true))){
    int cnt=0;
    while (cnt < wordCnt) {
      String word=DICTIONARY[rnd.nextInt(DICTIONARY.length)];
      writer.write(word + " ");
      cnt++;
    }
  }
 }

private void generateFile ( int wordCnt ) throws Exception { Random rnd = new Random ( System . currentTimeMillis ( ) ) ; try ( OutputStreamWriter writer = new OutputStreamWriter ( igfs . create ( FILE , true ) ) ) { int cnt = 0 ; while ( cnt < wordCnt ) { String word = DICTIONARY [ rnd . nextInt ( DICTIONARY . length ) ] ; writer . write ( word + " " ) ; cnt ++ ; } } }
generate file with random data and provided argument .
