The following code does work how I need it to, but it\'s ugly, excessive or a number of other things. I\'ve looked at formulas and attempted to write a few solutions, but I
Try it with switch casing...
Take a look here or here for more info about it
switch (expression)
{
case constant:
statements;
break;
[ case constant-2:
statements;
break; ] ...
[ default:
statements;
break; ] ...
}
You can add multiple conditions(not simultaneously) to it and even have a default option where no other cases have been satisfied.
PS: Only if one condition is to be satisfied..
If 2 conditions arise simultaneously.. I don't think switch can be used. But you can reduce your code here.
Java switch statement multiple cases