title: How to print this output in text file in java?
body: <p>I have calculated the words and now displaying it in console. But I want to write the console output to a text file. how to do this?</p>
  
  <pre><code>String[] wrds   = counter.getWords(WordCounter.SortOrder.BY_FREQUENCY);
  int[] frequency = counter.getFrequencies(WordCounter.SortOrder.BY_FREQUENCY);        
  
  int n = counter.getEntryCount();
  for (int i=0; i&lt;n; i++) 
  {
      This should be written in text file///// System.out.println(frequency[i] + " " + wrds[i]+" "+ counter.getWordCount());
  </code></pre>