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
Horrible abuse of exceptions. Don't ever do this! (It's not me, it's Josh Bloch's Effective Java). Anyway, I suggest
private static final Pattern HEXADECIMAL_PATTERN = Pattern.compile("\\p{XDigit}+");
private boolean isHexadecimal(String input) {
final Matcher matcher = HEXADECIMAL_PATTERN.matcher(input);
return matcher.matches();
}