
I am currently working on a java project and there is an if loop within the for loop....
for(int i = 1;i < iterationsNo;i++) {
if(areEqual(cluster1_output_record.get(i),clusterMean1) && areEqual(cluster2_output_record.get(i),clusterMean2) && iterationsNo > 1);
{
match = true;
System.out.println("Iteration Number is "+iterationsNo);
System.out.println("Value of i is "+i);
System.out.println("Cluster 1 Mean Elements are "+clusterMean1);
System.out.println("Cluster1_outpt_record is "+cluster1_output_record.get(i));
System.out.println("Cluster 2 Mean Elements are "+clusterMean2);
System.out.println("Cluster2_outpt_record is "+cluster2_output_record.get(i));
System.out.println("Match is "+match);
}
}
The output is Iteration Number is 2 Value of i is 1
Cluster 1 Mean Elements are [-0.3934348341558447, -0.1360816923944805, -0.2187716886412338, -0.06449051935568194, -0.0010228902759740104, -0.038266953181818164, 0.07982175983766239, 0.010644329474025934, 0.12632030505844166, -0.06995138039935068, -0.09870551273538966, -0.041796415043831185, 0.06937946180032464, -0.01377707767207793, -0.1236233396801949, -0.12645360842045458, -0.3304013244188308, -0.12054819756980542, 0.224283177465909, 0.10693851710064924] Cluster1_outpt_record is [0.026962710000000008, 0.06232899000000001, -0.36294179, -0.21924168999999996, 0.20080904000000005, -0.05111294000000001, 0.20181597, 0.08179009000000001, -0.32788965999999997, 0.4564200400000001, -0.450951, -0.10415492, 0.11374549999999999, 0.48815618999999993, -0.10235217, 0.11775965, -0.15073421, -0.27097621899999996, 0.012047309999999995, -0.08329656999999999] Cluster 2 Mean Elements are [0.01719762171005925, -0.20738010449999997, -0.2768948451183433, -0.06780662857396447, 0.087601948091716, 0.042040902568047316, -0.02697104016568048, 0.03858767211005916, 0.16336673178106492, -0.0747453844970414, -0.10509191156804738, -0.09977402825443794, 0.1397649665680474, -0.14198528071005925, -0.10507909705621307, -0.12943119110946746, -0.1155490924585799, -0.13362615999408278, 0.29367396437869797, 0.05711353221301773] Cluster2_outpt_record is [-0.2508608991546615, -0.16371195734745767, -0.23805550842478812, -0.06403854182319901, 0.028571258098516992, -0.009376577004237283, 0.040292195745762795, 0.01989580426822028, 0.14439635578177967, -0.07724384606567793, -0.09726075418961862, -0.06189477120444918, 0.09411107221292364, -0.06499922312076266, -0.1172088880805086, -0.13010673928177963, -0.25537655401800863, -0.12363725592266969, 0.2513768688336866, 0.0911138412309322]
Match is true
The values of cluster1outputrecord and clusterMean1 are not equal and so the the statements insdie the if loop must not be executed but still the control goes within the if loop... areEqual() is a method and it returns false. I have not included the output of the areEqual()but it shows false

Please specify the full code. Check your if condition. It seems that problem is there.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.