Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

indext of minimum element in an array in java

public static int indexOfSmallest(int[] array){
    int index = 0;
    int min = array[index];

    for (int i = 1; i < array.length; i++){
        if (array[i] <= min){
        min = array[i];
        index = i;
        }
    }
        return index;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #indext #minimum #element #array #java
ADD COMMENT
Topic
Name
6+4 =