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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!