Question: IN JAVA Add a function called anyOf to stdIntArray, which returns true if any array or sub-array element matches a given value, and false otherwise.
IN JAVA

Add a function called anyOf to stdIntArray, which returns true if any array or sub-array element matches a given value, and false otherwise. There should be two versions, one that works with the entire array, and one that works with sub-array defined by a half-open range. The signatures should be: public static boolean anyOf (int all, int value) public static boolean anyOf (int all, int lo, int hi, int value) The version that works with the entire array should call the sub-array version, just like we did in class with the other StdIntArray functions. For example, assume that array a- f1, 1, 4, 9, 9, 5, 7, 5). Then anyOf (a, 1) returns true anyOf (a, 2) returns false anyOf (a, 5) returns true anyOf (a, 8) returns false anyOf (a, 2, 6, 1) returns false anyOf (a, 2, 6, 4) returns true anyof(a, 2, 6, 5) returns true anyOf (a, 2, 6, 7) returns false anyof (a, 2, 2, 4) returns false
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
