I tried my code in several ways (using equals(), trim()) but the following code block seems to be not working despite the fact it executes the else block only. I am working on several arrays to get the confusion matrix in cross validation.
for (int x=0; x< clsNames.length; x++)
{
System.out.println("class: "+clsNames[x].trim());
for (int y=0; y<oftarray1.length ;y++)
{
System.out.println("first validation");
System.out.println(clsNames[x]);
System.out.println(oftarray1[y]);
System.out.println(clsName[y]);
if (oftarray1[y]== clsNames[x] && clsName[y]==oftarray1[y])
{
System.out.println("tp...");
truePositives++;
System.out.println("tp : "+truePositives++);
}
else if (oftarray1[y]==clsNames[x] && clsName[y]!=oftarray1[y])
{
System.out.println("fn...");
falseNegatives++;
System.out.println("fn : "+falseNegatives++);
}
else if (oftarray1[y]!=clsNames[x] && clsName[y]==oftarray1[y])
{
System.out.println("fp...");
falsePositives++;
System.out.println("fp : "+falsePositives++);
}
else
{
System.out.println("tn...");
trueNegatives++;
System.out.println("tn : "+trueNegatives++);
}
}
}