Does java have a int.tryparse that doesn't throw an exception for bad data?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1486077/java-good-way-to-encapsulate-integer-parseint">Java: Good way to encapsulate Integer.parseInt()</a><br>
  <a href="http://stackoverflow.com/questions/8362027/how-to-convert-a-string-to-float-and-avoid-using-try-catch-in-java">how to convert a string to float and avoid using try/catch in java?</a>  </p>
</blockquote>



<p>C# has Int.TryParse: <a href="http://msdn.microsoft.com/en-us/library/f02979c7.aspx">Int32.TryParse Method (String, Int32%)</a></p>

<p>The great thing with this method is that it doesn't throw an exception for bad data.</p>

<p>In java, <code>Integer.parseInt("abc")</code> will throw an exception, and in cases where this may happen a lot performance will suffer.</p>

<p>Is there a way around this somehow for those cases where performance is an issue?</p>

<p>The only other way I can think of is to run the input against an regex, but I have to test to see what is faster.</p>
