判断一个数字在不在某几个范围

http://www.iteye.com/problems/18525

这个是前几天整的一个判断1个数字在不在一个范围。
现在要判断一个数字在不在多个范围。
假如我要判断88 在不在 1-10, 40-80 , 80-199这几个范围之内 如何实现??
我觉得还是用以前的方法思路 就是把这3个范围分别循环进去 具体怎么实现

你可以把范围放到一个2维数组里面,遍历判断,不在就继续否则退出

[code="java"]
public class MethodTest {

public static void main(String[] args) {
    int current = 88;
    if(rangeInDefined(current, 1, 10))
        System.out.println(current + "在1——10之间");
    else if(rangeInDefined(current, 40, 80))
        System.out.println(current + "在40——80之间");
    else if(rangeInDefined(current, 80, 199))
        System.out.println(current + "在80——199之间");


}

public static boolean rangeInDefined(int current, int min, int max)
{
    return Math.max(min, current) == Math.min(current, max);
}

}

[/code]

List list1=new ArrayList();
list1.add(new Integer(1));
list1.add(new Integer(10));
list1.add(new Integer(88));
Collections.sort(list1);

    List list2=new ArrayList();
    list2.add(new Integer(40));
    list2.add(new Integer(80));
    list2.add(new Integer(88));
    Collections.sort(list2);

    List list3=new ArrayList();
    list3.add(new Integer(80));
    list3.add(new Integer(99));
    list3.add(new Integer(88));
    Collections.sort(list3);


    if(list1.get(1).equals(new Integer(88)))   
        System.out.println("在1——10之间");   
    else if(list2.get(1).equals(new Integer(88)))   
        System.out.println("在40——80之间");   
    else if(list3.get(1).equals(new Integer(88)))   
        System.out.println("在80——199之间");   

没有楼上的好,只是加一种解决办法