So I keep getting an error that says it cannot find symbol at the line "if (Character.isValidHex(thisChar, 16)) {" and I am wondering if this method is formatted correctly? I am having difficulty determining whether each individual character is a valid hex value (a-f) after determining if it is a digit or not. This is the section that determines the validity and this is my only error. I must separate the sections that use isdigit and the section that determines if it is a hex value, I cant combine and use Character.digit(thisChar, 16) !!! Please help!!
public static boolean isValidHex(String userIn) {
boolean isValid = false;
// The length is correct, now check that all characters are legal hexadecimal digits
for (int i = 0; i < 4; i++) {
char thisChar = userIn.charAt(i);
// Is the character a decimal digit (0..9)? If so, advance to the next character
if (Character.isDigit(thisChar)) {
isValid = true;
}
else {
//Character is not a decimal digit (0..9), is it a valid hexadecimal digit (A..F)?
if (Character.isValidHex(thisChar, 16)) {
isValid = true;
}
else {
// Found an invalid digit, no need to check other digits, exit this loop
isValid = false;
break;
}
}
}
// Returns true if the string is a valid hexadecimal string, false otherwise
return isValid;
}