Java Number Range Check inRange(int value, int min, int max)

Here you can find the source of inRange(int value, int min, int max)

Description

inRange checks if a value is between two other values

License

Open Source License

Parameter

Parameter Description
value test value
min a parameter
max a parameter

Return

true or false

Declaration

public static boolean inRange(int value, int min, int max) 

Method Source Code

//package com.java2s;
/**/*from w  ww.j a v  a 2 s.  co m*/
 * Copyright (c) 2010-2019 Contributors to the openHAB project
 *
 * See the NOTICE file(s) distributed with this work for additional
 * information.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0
 *
 * SPDX-License-Identifier: EPL-2.0
 */

public class Main {
    /**
     * inRange checks if a value is between two other values
     *
     * @param value test value
     * @param min
     * @param max
     * @return true or false
     */
    public static boolean inRange(int value, int min, int max) {
        if (value < min) {
            return false;
        }
        if (value > max) {
            return false;
        }
        return true;
    }
}

Related

  1. inRange(int minValue, int maxValue, int value)
  2. inRange(int n, int lo, int hi)
  3. inRange(int num, int from, int to, int flag)
  4. inRange(int value, int lowerBound, int upperBound)
  5. inRange(int value, int min, int max)
  6. inRange(int value, int min, int max)
  7. inRange(int value, int min, int max)
  8. inRange(int x, int a, int b)
  9. inRange(Integer x1, Integer y1, Integer x2, Integer y2)