Reading a String Array
<pre><code>System.out.println("Please enter the required word  :");
Scanner scan2 = new Scanner(System.in);
String word2 = scan2.nextLine();
String[] searchTerms = word2.split(" ");
boolean[] termFound = new boolean[searchTerms.length]; 
int numMatched;
String next;
int numofDoc = 0;

for (int i = 0; i &lt; filename; i++)
{ 
     numMatched = 0;

     Arrays.fill(termFound, false);
     BufferedReader in = new BufferedReader(new FileReader(
            "C:\\Users\\user\\fypworkspace\\TextRenderer\\abc" + i + ".txt"));
     Scanner s2 = new Scanner(in);

     while (s2.hasNext())
     {
          next = s2.next();
          for(int t = 0; t &lt; searchTerms.length; t++)
          {
               if (!termFound[t] &amp;&amp; next.equals(searchTerms[t]))
               {
                     termFound[t] = true;
                     numMatched++;
               }
          }
     }
     if (numMatched &gt; 0)
            numofDoc++;

} 
System.out.println("There were total of " + numofDoc  + " files containing this terms");
</code></pre>

<p>Hi, this is my edited code to determine whether a specific document contains a term. If the document contains the term, it will increment the number of document counter by one.</p>

<p>The problem is, I only managed to calculate for one term only. Mind to point out my mistake? </p>

<p>Lets say I enter 'a about the' = It only process the first word which is 'a'.</p>

<p>This file contain the term is 6</p>

<p>I now trying to get the output </p>

<p>This file contain the term is 6</p>

<p>This file contain the term is 4</p>

<p>This file contain the term is 6</p>
