This commit is contained in:
Tim Tersch
2020-08-27 10:59:49 +02:00
parent 8f735d4b9f
commit 24bdbc7e01

View File

@@ -159,8 +159,11 @@ public class Arrays {
* Für ein leeres Array wird 0 zurück gegeben.
*/
public double avg( int[] pArray ) {
if (pArray == null || pArray.length == 0) {
return 0;
}
return sum(pArray) / pArray.length;
}
/**
* Prüft, ob <b>alle</b> Elemente in einem Array von