Java loop and increment problem

Posted by user552961 on Stack Overflow See other posts from Stack Overflow or by user552961
Published on 2010-12-24T15:14:22Z Indexed on 2010/12/25 1:54 UTC
Read the original article Hit count: 130

Filed under:
|
|

Can any one tell me what is the problem in my program?

String a[],b[];
int c[] = new int[b.length];

for (int j = 0; j < a.length; j++) {
    for (int k = 0; k < b.length; k++) {
        if (b[k].equals(a[j])) {
            c[k]++;
        } else {
            c[k] = 0;
        }
    }
}

I have thousands of words stored in a HashMap. Now I want to check in every file that how many time one word occurred from allWords.

Can you point out mistake in my program or give me your idea that how I can do it?

© Stack Overflow or respective owner

Related posts about java

Related posts about data-structures