title: Java read data from Excel
body: <p>I want to read data from Excel - only numbers so I can compare it later, I go in a loop and I have code like this:</p>
  
  <pre><code>int type = cell.getCellType();
      switch(type){
      case 0:
          int value = (int)cell.getNumericCellValue();
      case 1:
          String temp = cell.getStringCellValue();
          int value = Integer.parseInt(temp);
  
      }
  </code></pre>
  
  <p>It's like this because sometimes data in Excel have numeric type, sometimes string type.</p>
  
  <p>Now my questions. Is casting to <code>int</code> a good idea?
  If I have number <code>1.200</code> in a cell with type <code>String</code> so it's "1.200" how to convert it to <code>int</code> (or <code>float</code> if it's better)? What is the best way to do it?</p>
  
  <p>All I need is - numbers (sometimes from <code>String</code> cell types) so I can compare it with numbers from another datasource.</p>