how do i total each file query count?
<pre><code>for (a = 0; a &lt; filename; a++) {

        try {
            System.out
                    .println(" _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  ");
            System.out.println("\n");
            System.out.println("The word inputted : " + word2);
            File file = new File(
                    "C:\\Users\\user\\fypworkspace\\TextRenderer\\abc" + a
                            + ".txt");
            System.out.println(" _________________");

            System.out.print("| File = abc" + a + ".txt | \t\t \n");

            for (int i = 0; i &lt; array2.length; i++) {

                totalCount = 0;
                wordCount = 0;

                Scanner s = new Scanner(file);
                {
                    while (s.hasNext()) {
                        totalCount++;
                        if (s.next().equals(array2[i]))
                            wordCount++;

                    }

                    System.out.print(array2[i] + " --&gt; Word count =  "
                            + "\t " + "|" + wordCount + "|");
                    System.out.print("  Total count = " + "\t " + "|"
                            + totalCount + "|");
                    System.out.printf("  Term Frequency =  | %8.4f |",
                            (double) wordCount / totalCount);

                    System.out.println("\t ");

                    double inverseTF =  Math.log10((float) numDoc
                            / (numofDoc[i]));
                    System.out.println("    --&gt; IDF = " + inverseTF );

                    double TFIDF = (((double) wordCount / totalCount) * inverseTF);
                    System.out.println("    --&gt; TF/IDF = " + TFIDF + "\n");





                }
            }
        } catch (FileNotFoundException e) {
            System.out.println("File is not found");
        }

    }
}
</code></pre>

<p>This is my code to calculate the term frequency for each of the query i input inside. 
Now i am trying to total each query frequency for each file. </p>

<p>Example output :</p>

<p>The number of files is this folder is : 11
Please enter the query  :
how are you
how --> This number of files that contain this term  3
are --> This number of files that contain this term  7
you --> This number of files that contain this term  7</p>

<hr>

<p>The word inputted : how are you</p>

<hr>

<p>| File = abc0.txt |<br>
how --> <strong>Word count</strong> =     |4|  Total count =      |957|  Term Frequency =  |   0.0042 |<br>
    --> IDF = 0.5642714398516419
    --> TF/IDF = 0.0023585013159943234</p>

<p>are --> <strong>Word count</strong> =     |7|  Total count =      |957|  Term Frequency =  |   0.0073 |<br>
    --> IDF = 0.1962946357308887
    --> TF/IDF = 0.00143580193324579</p>

<p>you --> <strong>Word count</strong> =     |10|  Total count =     |957|  Term Frequency =  |   0.0104 |<br>
    --> IDF = 0.1962946357308887
    --> TF/IDF = 0.002051145618922557</p>

<p>Example : The total frequency is 4 + 7 + 10 = 21..</p>

<hr>

<p>The word inputted : how are you</p>

<hr>

<p>| File = abc1.txt |<br>
how --> <strong>Word count</strong> =     |4|  Total count =      |959|  Term Frequency =  |   0.0042 |<br>
    --> IDF = 0.5642714398516419
    --> TF/IDF = 0.0023535826479734803</p>

<p>are --> <strong>Word count</strong> =     |7|  Total count =      |959|  Term Frequency =  |   0.0073 |<br>
    --> IDF = 0.1962946357308887
    --> TF/IDF = 0.0014328075600794795</p>

<p>you --> <strong>Word count</strong> =     |10|  Total count =     |959|  Term Frequency =  |   0.0104 |<br>
    --> IDF = 0.1962946357308887
    --> TF/IDF = 0.002046867942970685</p>

<p>How can i make it to total the 3 queries <strong>WORD COUNT</strong> for each file ? </p>

<p>Example : The total frequency is 4 + 7 + 10 = 21..</p>
