java calculate max and min of numbers

// Sort one by one to calculate the minimum value of the array

class Oby

{

public void sort( int array[])

//set the first to be the smallest number

 

{

int minMath = array[0];

int index =0;

for (int i=0;i<array.length;i++)

{

if(minMath > array[i])

{

minMath =array[i];

index =i+1;

}

}

 

System.out.println("The minimum value is "+minMath+" The following table is "+ index);

}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326491182&siteId=291194637