JavaAlgorithms/Maths/FindMin.java
UntouchedOdin0 6252b4eff8
Update FindMin.java
Re-word the comments
2019-10-23 21:22:14 +01:00

27 lines
597 B
Java

package Maths;
public class FindMin {
//Driver
public static void main(String[] args) {
int[] array = {2, 4, 9, 7, 19, 94, 5};
System.out.println("min = " + findMax(array));
}
/**
* Find the minimum number of an array of numbers.
*
* @param array the array contains element
* @return min value
*/
public static int findMax(int[] array) {
int min = array[0];
for (int i = 1; i < array.length; ++i) {
if (array[i] < min) {
min = array[i];
}
}
return min;
}
}