Java tutorial
//package com.java2s; public class Main { /** * whether the value in the all-close range [minValue, MaxValue]. * * @param minValue * @param MaxValue * @param value * @return */ public static boolean isInRange(int minValue, int MaxValue, int value) { boolean inRange = false; int min = Math.min(minValue, MaxValue); int max = Math.max(minValue, MaxValue); if (value >= min && (value <= max)) { inRange = true; } return inRange; } }