title: NumberFormatException parseInt Java
body: <p>I am trying to differentiate and store data (Point: x, y) from a text file in two arraylists: knots and zeros. Data File just contains integers or decimal values.</p>
  
  <pre><code>Data File:
  x    y  type(zero/knot) 
  46  10      2
  13  5       2
  27  21      1
  </code></pre>
  
  <p>But my code is throwing NumberFormatException:48 </p>
  
  <pre><code>import java.util.*;
  import java.util.ArrayList;
  import java.io.*;
  import java.awt.Point;
  
  public class program {
  
      public static void main(String []args)  {
          ArrayList knots = new ArrayList&lt;Point&gt;();
          ArrayList zeros = new ArrayList&lt;Point&gt;();
          List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();
          String line = null;
          String file = "data1.txt";
          BufferedReader reader;
          try  {
              reader = new BufferedReader(new FileReader(file));
              while((line = reader.readLine()) != null)  {
                  String tmp[] = line.split(" ");
                  System.out.println(line);
                  for (String s:tmp) {
                      s = s.replace("\r\n","");
                      int i = Integer.parseInt(s.trim());
                      //knots.add(new Point();
                  System.out.println(s);
                }
              }
          }
  
          catch (FileNotFoundException e)  {
              e.printStackTrace();
          } catch (IOException e)  {
              e.printStackTrace();
          }
              }
          }
  </code></pre>