Java Number Range Check inRange(final float testNum, final float min, final float max)

Here you can find the source of inRange(final float testNum, final float min, final float max)

Description

Is testNum in range?

License

BSD License

Parameter

Parameter Description
testNum Number to test.
min Left endpoint of range.
max Right endpoint of range.

Return

T/F.

Declaration

public static boolean inRange(final float testNum, final float min, final float max) 

Method Source Code

//package com.java2s;
/*L//  w  ww.j a  v  a 2  s.  c  o m
 *  Copyright RTI International
 *
 *  Distributed under the OSI-approved BSD 3-Clause License.
 *  See http://ncip.github.com/webgenome/LICENSE.txt for details.
 */

public class Main {
    /**
     * Is <code>testNum</code> in range?
     * @param testNum Number to test.
     * @param min Left endpoint of range.
     * @param max Right endpoint of range.
     * @return T/F.
     */
    public static boolean inRange(final float testNum, final float min, final float max) {
        boolean in = false;
        if (!Float.isNaN(testNum)) {
            in = testNum >= min && testNum <= max;
        }
        return in;
    }
}

Related

  1. inRange(double value, double min, double max)
  2. inRange(double value, double min, double max)
  3. inRange(double value, double target, double range)
  4. inRange(double x, double y, double z, double sx, double sy, double sz, double r)
  5. inRange(E element, E min, E max)
  6. inRange(final int id, final int min, final int max)
  7. inRange(final int value, final int min, final int max)
  8. inRange(final int value, final int min, final int max, final String fieldName)
  9. inRange(float n, float min, float max)