I\'m trying to find the minimum value of numbers in an array but it doesn\'t always work out properly. This is the code I wrote:
for (int i=0; i <
A way to do it would be using the java.util.Arrays class:
Example:
public class ArraySort {
public static void main(String[] args) {
int[] array = {12, 4, 6, 1, 56, 21, 77};
Arrays.sort(array);
System.out.println(array[0]);
}
}
From the Java doc, Arrays.sort(int[]) sort the specified array into ascending numerical order.
So the output here prints 1.