title: Java NumberFormatException Error String to Float
body: <p>Taking in a list of strings and converting them to a float and storing the values. I get this error when hitting the second value I want to store. Below is the code and the text file I'm reading from:</p>
  
  <pre><code>    public static void readCities() {
      StringBuilder sb = new StringBuilder();
      BufferedReader br = null;
      try {
          br = new BufferedReader(new FileReader("C:/Users/Luke/workspace/Traveling Sales Person/Destinations/11PointDFSBFS.tsp"));
          String line;
          while ((line = br.readLine()) != null) {
              if (sb.length() &gt; 0) {
                  sb.append("\n");
              }
              sb.append(line);
          }
      } catch (IOException e) {
          e.printStackTrace();
      } finally {
          try {
              if (br != null) {
                  br.close();
              }
          } catch (IOException ex) {
              ex.printStackTrace();
          }
      }
      String contents = sb.toString();
      String[] parts = contents.split("NODE_COORD_SECTION");//splits into locations
      String[] locations = parts[1].split(" ");
      int counter = 0;
      for (int i = 1; i &lt; locations.length; i++) {
          cities[counter] = new City(Float.parseFloat(locations[i+1]), Float.parseFloat(locations[i+2]));
          counter++;
      }
  }
  </code></pre>
  
  <p>Code error:</p>
  
  <pre><code>    Exception in thread "main" java.lang.NumberFormatException: For input string: "63.860370
  2
      at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
      at sun.misc.FloatingDecimal.parseFloat(FloatingDecimal.java:122)
      at java.lang.Float.parseFloat(Float.java:451)
      at TSP.readCities(TSP.java:132)
      at TSP.main(TSP.java:28)
  </code></pre>