Java Number Range Check inRange(long value, long lowerBound, long upperBound)

Here you can find the source of inRange(long value, long lowerBound, long upperBound)

Description

Validates whether a given value falls inside the given range.

License

Apache License

Parameter

Parameter Description
value a parameter
lowerBound the lower bound (inclusive!) of the range that is valid;
upperBound the upper bound (inclusive!) of the range that is valid;

Return

true if the value is inside the defined range, false if it is outside.

Declaration

public static boolean inRange(long value, long lowerBound, long upperBound) 

Method Source Code

//package com.java2s;
/*/*from w  ww.  ja  v a2s  .  co m*/
 * LibTDL - Library for parsing/handling the "Trigger Definition Language".
 *
 * (C) Copyright 2012-2013 - J.W. Janssen, <j.w.janssen@lxtreme.nl>
 *
 * Licensed under Apache Software License version 2.0, see <http://www.apache.org/licenses/LICENSE-2.0.html>.
 */

public class Main {
    /**
     * Validates whether a given value falls inside the given range.
     * 
     * @param value
     * @param lowerBound
     *            the lower bound (inclusive!) of the range that is valid;
     * @param upperBound
     *            the upper bound (inclusive!) of the range that is valid;
     * @return <code>true</code> if the value is inside the defined range,
     *         <code>false</code> if it is outside.
     */
    public static boolean inRange(long value, long lowerBound, long upperBound) {
        return ((value >= lowerBound) && (value <= upperBound));
    }
}

Related

  1. inRange(int value, int min, int max)
  2. inRange(int value, int min, int max)
  3. inRange(int value, int min, int max)
  4. inRange(int x, int a, int b)
  5. inRange(Integer x1, Integer y1, Integer x2, Integer y2)
  6. inrange2(double value, double min, double max)
  7. rangeCheck(double value)
  8. rangeCheck(final C start, final C end, final C step)
  9. rangeCheck(final int value, final int min, final int max)