title: How to format the values which comes from excel using java
body: <p>I have a excel file with some values like : </p>
  
  <pre><code>**Status Code** **Method Name**
  400                  createRequest
  401                  testRequest
  402                  mdm
  403                  fileUpload
  </code></pre>
  
  <p>and the following code to read and print the data[Late on i will put them in HashMap]</p>
  
  <pre><code>package com.poc.excelfun;
  
  import java.io.File;
  import java.io.FileInputStream;
  import java.io.FileNotFoundException;
  import java.io.IOException;
  import java.util.Iterator;
  
  import org.apache.poi.hssf.usermodel.HSSFSheet;
  import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  import org.apache.poi.ss.usermodel.Cell;
  import org.apache.poi.ss.usermodel.Row;
  
  public class ReadExcelData {
      public static void main(String[] args) {
          try {
  
              FileInputStream file = new FileInputStream(new File("attachment_status.xls"));
  
              //Get the workbook instance for XLS file 
              HSSFWorkbook workbook = new HSSFWorkbook(file);
  
              //Get first sheet from the workbook
              HSSFSheet sheet = workbook.getSheetAt(0);
  
              //Iterate through each rows from first sheet
              Iterator&lt;Row&gt; rowIterator = sheet.iterator();
              while(rowIterator.hasNext()) {
                  Row row = rowIterator.next();
  
                  //For each row, iterate through each columns
                  Iterator&lt;Cell&gt; cellIterator = row.cellIterator();
                  while(cellIterator.hasNext()) {
  
                      Cell cell = cellIterator.next();
  
                      switch(cell.getCellType()) {
                          case Cell.CELL_TYPE_BOOLEAN:
                              System.out.print(cell.getBooleanCellValue() + "\t\t");
                              break;
                          case Cell.CELL_TYPE_NUMERIC:
                              System.out.print(cell.getNumericCellValue() + "\t\t");
                              break;
                          case Cell.CELL_TYPE_STRING:
                              System.out.print(cell.getStringCellValue() + "\t\t");
                              break;
                      }
                  }
                  System.out.println("");
              }
              file.close();
              /*
               * The following code to create a new work book with the value fetched from the given work book
               * FileOutputStream out = 
                  new FileOutputStream(new File("attachment_status_new.xls"));
              workbook.write(out);
              out.close();*/
  
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  
  }
  </code></pre>
  
  <p>but the above code returns the following :</p>
  
  <pre><code>Status Code     Method Name     
  400.0       createRequest       
  401.0       testRequest     
  402.0       mdm     
  403.0       fileUpload
  </code></pre>
  
  <p>If wee the out put the status code comes with <code>.0</code> but i want to get only <code>400</code> not with <code>.0</code></p>
  
  <p>How to do this.</p>
  
  <p>I have used <code>poi</code> for excel manipulations.</p>
  
  <p>Best Regards
  Anto</p>