Question
in java Complete the method, named findValue, in the class named ArrayOps.java. There are two parameters to this method: the first is an integer array
in java
Complete the method, named findValue, in the class named ArrayOps.java. There are two parameters to this method: the first is an integer array and the second is a integer value.
This method should use a linear search to try to find an instance of the integer value parameter within the array. If the value is in the array, the method returns the subscript of the array where the value was found. If the value is not in the array, the value of the length of the array is returned (as that is a higher value than any of the array subscripts).
Complete the following file:
ArrayOps.java
public class ArrayOps { /** This method performs a linear search on the array identified by the first parameter, while looking for the value indicated by the second parameter. @param values, an array of integers @param valueToFind, an integer to look for in the array values @ return, the index (subscript) of the array where the value was found OR the length of the array if it was not found. */ public static int findValue(int values[], int valueToFind) {
// your work here
} }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started