I have multiple strings that may or may not be equal to a double value (e.g. "444", "44.4", "-0.0044"). I was wondering what the most efficient way would be to check if it is equal to a double. At first I was using a try-catch statement but other posts on StackOverflow have said that those are costly to performance if an exception is thrown. Here is the code I have so far:
try {
double a = Double.parseDouble("444");
return true;
}
catch (NumberFormatException e) {
return false;
}