forked from IF-LK-2020/array
over() finished
This commit is contained in:
@@ -329,8 +329,17 @@ public class Arrays {
|
||||
* Für ein leeres Array wird 0 zurück gegeben.
|
||||
*/
|
||||
public int over( int[] pArray, int pValue ) {
|
||||
if( pArray.length == 0 ) {
|
||||
return 0;
|
||||
}
|
||||
int sum =0;
|
||||
for(int i=0;i<pArray.length;i++){
|
||||
if(pArray[i]>pValue){
|
||||
sum++;
|
||||
}
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Erstellt ein Integer-Array mit den ersten <var>pNumberOfElements</var>
|
||||
|
||||
Reference in New Issue
Block a user