Write (define) a public static method named getAllLessThan, that takes an array of int, and an int as arguments and returns a an int array with all of the values in the argument array that are less than the second argument value. For example, given the following Array declaration and instantiation: int[] myArray = {1, 22, 333, 400, 5005, 9}; getAllLessThan(myArray, 300) will return an Array of int with these values {1, 22, 9} 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 getAllLessThan, that takes an array of int, and an int as arguments and returns a an int array with all of the values in the argument array that are less than the second argument value.
For example, given the following Array declaration and instantiation:
int[] myArray = {1, 22, 333, 400, 5005, 9};
getAllLessThan(myArray, 300) will return an Array of int with these values {1, 22, 9}
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