Write (define) a public static method named getInRange, that takes three arguments. The first argument is an Array of int. The second and third arguments will be int values, where the second argument value is guaranteed to be not more than the third argument value. This method must create and return an array of all of the values in the argument array that are between the second and third argument values (inclusive). For example, given the following Array declaration and instantiation: int[] myArray = {1, 22, 333, 400, 5005, 9}; getInRange(myArray, 100, 1000) will return an Array of int with these values {333, 400} Note that the values in the returned array must be in the same order as they are in the argument array. You may wish to write some additional code to test your method. ------------------------------------------------------- public class Main { public static void main(String[] args) { // you may wish to write some code in this main method // to test your method. } }
Write (define) a public static method named getInRange, that takes three arguments. The first argument is an Array of int. The second and third arguments will be int values, where the second argument value is guaranteed to be not more than the third argument value. This method must create and return an array of all of the values in the argument array that are between the second and third argument values (inclusive).
For example, given the following Array declaration and instantiation:
int[] myArray = {1, 22, 333, 400, 5005, 9};
getInRange(myArray, 100, 1000) will return an Array of int with these values {333, 400}
Note that the values in the returned array must be in the same order as they are in the argument array.
You may wish to write some additional code to test your method.
-------------------------------------------------------
public class Main {
public static void main(String[] args) {
// you may wish to write some code in this main method
// to test your method.
}
<your method definition here>
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images