This helper method checks if a given number is in between the range of the two numbers. I tried using >= and <= but they did not work. This method did the trick. I forgot where I found this one. It was in a forum about Java.

This method returns true if a number is between a number range.

If you want to use float or double values, you can use the same method and replace the int data type to either a float or double.

Related Posts Plugin for WordPress, Blogger...