一、封装代码:
public static boolean rangeInDefined(int current, int min, int max) {
return Math.max(min, current) == Math.min(current, max);
}
二、测试类:
public static void main(String[] args) {
int current = 50;
if (rangeInDefined(current, 1, 10)) {
System.out.println(current + "再1-10之间");
}else {
System.out.println("不再");
}
}
三、返回结果: