How to check if a String is a numeric type in Java

public static boolean isNumeric(String string)  
{  
  try  
  {  
    double d = Double.parseDouble(string);  
  }  
  catch(NumberFormatException e)  
  {  
    return false;  
  }  
  return true;  
}

Comments