Java Number Range Check rangeCheck(int value, int begin, int end)

Here you can find the source of rangeCheck(int value, int begin, int end)

Description

range Check

License

Open Source License

Declaration

private static int rangeCheck(int value, int begin, int end) 

Method Source Code

//package com.java2s;
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
 * This code is licensed under the GPL 2.0 license, available at the root
 * application directory.//w  ww.j a v  a  2 s.co  m
 */

public class Main {
    private static int rangeCheck(int value, int begin, int end) {
        if (value >= begin && value <= end) { // (begin,end]
            return value;
        }

        throw new IllegalArgumentException("Value [" + value
                + "] not in range [" + begin + "," + end + "]");
    }
}

Related

  1. rangeCheck(final int value, final int min, final int max)
  2. rangeCheck(int arrayLen, int fromIndex, int toIndex)
  3. rangeCheck(int arrayLength, int offset, int length)
  4. rangeCheck(int index, int size)
  5. rangeCheck(int length, int fromIndex, int toIndex)
  6. rangeCheck(int value, int min, int max)
  7. rangeCheckForAdd(int index, int size)