style: include IMC_IMMATURE_CLASS_VAR_NAME
(#5197)
This commit is contained in:
parent
5e4db7baf1
commit
2e387fe54e
@ -216,9 +216,6 @@
|
||||
<Match>
|
||||
<Bug pattern="FCBL_FIELD_COULD_BE_LOCAL" />
|
||||
</Match>
|
||||
<Match>
|
||||
<Bug pattern="IMC_IMMATURE_CLASS_VAR_NAME" />
|
||||
</Match>
|
||||
<Match>
|
||||
<Bug pattern="CFS_CONFUSING_FUNCTION_SEMANTICS" />
|
||||
</Match>
|
||||
|
@ -5,16 +5,16 @@ public final class StandardDeviation {
|
||||
}
|
||||
|
||||
public static double stdDev(double[] data) {
|
||||
double var = 0;
|
||||
double variance = 0;
|
||||
double avg = 0;
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
avg += data[i];
|
||||
}
|
||||
avg /= data.length;
|
||||
for (int j = 0; j < data.length; j++) {
|
||||
var += Math.pow((data[j] - avg), 2);
|
||||
variance += Math.pow((data[j] - avg), 2);
|
||||
}
|
||||
var /= data.length;
|
||||
return Math.sqrt(var);
|
||||
variance /= data.length;
|
||||
return Math.sqrt(variance);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user