Ask Question
Today, 17:45

Create a static method called findlargest, which takes an array of integers as an input parameter and returns the array index of the largest integer in the array. if there are positions that are tied for largest, the method should return the first index with a largest value.

+4
Answers (1)
  1. Today, 19:16
    0
    Public static int findlargest (int[] theArray)

    {

    int index = 0;

    int maxVal = 0;

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

    {

    if (theArray[ i ] > maxVal)

    {

    maxVal = theArray[ i ];

    index = i;

    }

    }

    return (index);

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Create a static method called findlargest, which takes an array of integers as an input parameter and returns the array index of the ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers