Is there an analogous form of the following code:
if(month == 4,6,9,11)
{
do something;
}
Or must it be:
if(month == 4 ||
For dates I use Joda Time mentioned earlier, but I understand if it's not applicable for you. If you just want it to look nice, you can first define a list with values that you're interested in and then check if your month is in that list:
// This should be a field in a class
// Make it immutable
public static final List LONGEST_MONTHS =
Collections.immutableList(Arrays.asList(4,6,9,11));
// Somewhere in your code
if(LONGEST_MONTHS.contains(month)) {
doSomething();
}