If this question was repeated, I'm sorry but I couldn't find the answer. My question is how to code for "If any of these variables equals this" and change it to a new value corresponding to that variable. For instance, I'm trying to do HTML conversions:
int hex1 = (int)(Math.floor((work[j][k]) / 1048576)) % 16;
int hex2 = (int)(Math.floor((work[j][k]) / 65536)) % 16;
int hex3 = (int)(Math.floor((work[j][k]) / 4096)) % 16;
int hex4 = (int)(Math.floor((work[j][k]) / 256)) % 16;
int hex5 = (int)(Math.floor((work[j][k]) / 16)) % 16;
int hex6 = (int)(work[j][k]) % 16;
Above would be my list of multiple variables. So pseudocode would be "if any of the above variables equals this". So if either hex1,hex2,hex3,hex4,hex5,hex6 equals, say 10. Then the corresponding variable would do something. For instance:
String html = "";
if (hex1==10){
html += "A";
}
else if (hex1==11){
html += "B";
}
else if (hex1 >= 0 && hex1 <=9){
html += hex1;
}
html = "#" + html;
Is there a way to do this above code, without having to copy/paste the code 6 different times with a different variable each time (ie, hex1 would be hex2, hex3,...)?