Failed to parse a String to int
<p>I don't know what's wrong with parsing the String to an int part in my code.   Before the parsing, everything looks correct.</p>

<pre><code>import java.io.IOException;

public class TheWindow {

    public static void main(String[] args) throws IOException{

        String s = "13.16";
        double d = Double.parseDouble(s);
        System.out.println(d);
        char[] ch = s.toCharArray();
        char[] ch2 = new char[s.length()];
        for(int i = 0; i &lt; ch.length; i++){
            if(ch[i] == '.'){
                break;
            }else{
                ch2[i] = ch[i];
            }
        }
        String s2 = new String(ch2);
        System.out.println(s2);
        try{
            s2.trim();
            int newI = Integer.parseInt(s2);
            System.out.println(newI);
        }catch(Exception e){
            System.out.println("Failed");
        }
    }
}
</code></pre>