public class Main
{
public static void MinMaxArray(float[] number, float min, float max)
{
max = number[0];
min = number[0];
for (int i = 1; i < number.length; i++)
{
if (number[i] > max)
{
max = number[i];
}
if (number[i] < min)
{
min = number[i];
}
}
}
public static void main(String[] args)
{
float[] data = {3.5f, 0.5f, 9, 0f};
float min = 0.0f;
float max = 0.0f;
MinMaxArray(data, min, max);
System.out.printf("Minimun: %1$s - Maximun: %2$s" + "\r\n", min, max);
}
}