Exception on this line of code
<pre><code>if(str.contains("final"))
{
    id = Integer.parseInt(str.substring(18, str.length() - 6));    
}
System.out.println(id);
</code></pre>

<p>This line of code <code>id = Integer.parseInt(str.substring(18, str.length() - 6));</code>
I got the output as "final year" but it throws an illegalnumberformat exception 
For input string: " final Year"</p>

<pre><code>at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at Product.main(Product.java:47)
</code></pre>

<p>How to solve this issue?</p>

<p>I have a text file which has both string and int in it like </p>

<p>final year
 93
 93 
 90
 91.<br>
 In this input given,I need to find the "final year" string and display the count of the number's below it without repetition.How can I do that</p>
