Verify if String is hexadecimal
I have a String like "09a" and I need a method to confirm if the text is hexadecimal. The code I've posted does something similar, it verifies that a string is a decimal number. I want to do the same, but for hexadecimal.
private static boolean isNumeric(String cadena) {
try {
Long.parseLong(cadena);
return true;
} catch (NumberFormatException nfe) {
JOptionPane.showMessageDialog(null,"Uno de los números, excede su capacidad.");
return false;
}
}