int num = .....
if(num>100 &&num<200)
{
//num 值 介于100~200
}
else if(num >201 &&num <300)
{
//num值 介于201~300
}
else if(...)以此类推
public static void main(String[] args) {Scanner sc = new Scanner(System.in)
List<Integer> list = new ArrayList<Integer>(7)
while (list.size() < 7) {
System.err.println(String.format("第%s个数字:", list.size() + 1))
try {
int i = Integer.valueOf(sc.next())
if (!list.contains(i)) {
if ((list.size() < 6 && i >= 1 && i <= 33) || (list.size() == 6 && i >= 1 && i <= 16))
list.add(i)
else
throw new Exception(String.format("数字不在区间%s内", list.size() < 6 ? "[1,33]" : "[1,16]"))
} else
throw new Exception("输入重复")
} catch (NumberFormatException e) {
System.err.println("请输入数字")
sc.reset()
} catch (Exception e) {
System.err.println(e.getMessage())
sc.reset()
}
}
System.out.println("结束")
}