private static int getMaxValue(int[] Value){
double maxValue = Value[0];
for(int i=1;i < Value.length;i++){
if(Value[i] > maxValue){
maxValue = Value[i];
}
}
return maxValue;
}
private static int getMinValue(int[] Value){
double maxValue = Value[0];
for(int i=1;i < Value.length;i++){
if(Value[i] < maxValue){
maxValue = Value[i];
}
}
return maxValue;
}
You can simply copy and paste these methods in your program. You can send array of values as parameter and get minimum or maximum value.
You can also change method return type and type of array to get minimum or maximum of double values
No comments:
Post a Comment