Solution for filterRange.java

Was going through some exercises for school, thought of other solutions that could help!