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

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

Description

in Range

License

Open Source License

Declaration

public static int inRange(int checkValue, int min, int max) 

Method Source Code

//package com.java2s;
// The MIT License (MIT)

public class Main {
    public static int inRange(int checkValue, int min, int max) {
        if (checkValue < min) {
            return min;
        }//from   w w  w  .  j a  v a 2 s  . c om
        if (checkValue > max) {
            return max;
        }
        return checkValue;
    }

    public static double inRange(double checkValue, double min, double max) {
        if (checkValue < min) {
            return min;
        }
        if (checkValue > max) {
            return max;
        }
        return checkValue;
    }
}

Related

  1. inRange(final int value, final int min, final int max)
  2. inRange(final int value, final int min, final int max, final String fieldName)
  3. inRange(float n, float min, float max)
  4. inrange(int actual, int leftRange, int rightRange)
  5. inRange(int check, int range)
  6. inRange(int firstIndex, int secondIndex)
  7. inRange(int l, int u, int v, int... v_)
  8. inRange(int minValue, int maxValue, int value)
  9. inRange(int n, int lo, int hi)