This enum is optional, but helps with code clarity:
enum Field {
INT_HX,
INT_EX,
INT_RX,
INT_MX,
INT_IX
}
Then test the values:
Field largestField = Field.INT_HX;
int largestValue = intHx;
if(intEx > largestValue) {
largestField = Field.INT_EX;
largestValue = intEx;
}
if(intRx > largestValue) {
largestField = Field.INT_RX;
largestValue = intRx;
}
if(intMx > largestValue) {
largestField = Field.INT_MX;
largestValue = intMx;
}
if(intIx > largestValue) {
largestValue = intIx;
}
switch(largestField) {
case INT_HX:
// call the intHx related method
break;
case INT_EX:
// call the intEx related method
break;
case INT_RX:
// call the intRx related method
break;
case INT_MX:
// call the intMx related method
break;
case INT_IX:
// call the intIx related method
break;
}
1
solved Find the Variable with biggest int value