You could use an enum
to represent your ranges,
public static enum IntRange {
ONE_TO_FIVE, SIX_TO_TEN;
public boolean isInRange(int v) {
switch (this) {
case ONE_TO_FIVE:
return (v >= 1 && v <= 5);
case SIX_TO_TEN:
return (v >= 6 && v <= 10);
}
return false;
}
public static IntRange getValue(int v) {
if (v >= 1 && v <= 5) {
return ONE_TO_FIVE;
} else if (v >= 6 && v <= 10) {
return SIX_TO_TEN;
}
return null;
}
}