Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

get minimum of array java

int /*OR*/ double /*OR*/ float[] array_of_numbers = {/*Whatever values you want*/}
/*For this example we're just using a regular integer array*/
int min = array_of_numbers[0]; /*Important to initialise the first value!!!!*/
   for (int i = 0; i < array_of_numbers.length; i++) {
        if(array_of_numbers[i] < min) { /* So now we can make the comparison*/
            min = array_of_numbers[i];  /* If smaller, make it the new minimum*/
        }
   }
   System.out.println("Minimum value in array: " + min)
 
PREVIOUS NEXT
Tagged: #minimum #array #java
ADD COMMENT
Topic
Name
1+7 =