title: number format exception while converting substring part
body: <p>I'm trying to make an auto increment function that each time user create table <code>Departmenent_id(varchar)</code> is incremented and the id i have given A1,A2..... so what i do in my autoincrement() that i use  the list of ,result getting from <code>select Dept_id from Department</code>  and try to separate the integer part from this and adding to <code>TreeSet</code> collection and taking out largest element and adding to first part of String but problem i face when i take out the substring of string  like <code>9</code> and parsing it into integer i m getting <code>number format exception</code>. Why am I getting this problem my function code is right here</p>
  
  <pre><code>    private String autoIncreament() {
      String id = null;
      String num = null;
      String result = "SELECT DEPARTMENT_ID FROM  Department";
      TreeSet&lt;Integer&gt; treeSet = new TreeSet&lt;Integer&gt;();
      List&lt;Map&lt;String, Object&gt;&gt; result1 = getJdbcTemplate().queryForList(
              result);
      for (Map&lt;String, Object&gt; map : result1) {
          id = (String) map.get("DEPARTMENT_ID");
          System.out.println("id=" + id);
          num = id.substring(1);
          int number = Integer.parseInt(num);
          treeSet.add(number);
  
      }
  
      Integer in = treeSet.pollLast();
               int c=in.intValue();
                 c++;
      id = id +c ;
      /* System.out.println("jcak="+rowSet.getRow()); */
      return id;
  }
  </code></pre>
  
  <p>my exception details</p>
  
  <pre><code>    19 Dec, 2012 11:25:14 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
  INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@5d764be1: startup date [Wed Dec 19 11:25:14 IST 2012]; root of context hierarchy
  19 Dec, 2012 11:25:14 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  INFO: Loading XML bean definitions from class path resource [mybeans.xml]
  19 Dec, 2012 11:25:14 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
  INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7b5a6029: defining beans [dataSource,employeeDaoImpl,departmentdao]; root of factory hierarchy
  19 Dec, 2012 11:25:14 AM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
  INFO: Loaded JDBC driver: com.mysql.jdbc.Driver
  ankur=com.nousinfo.tutorial.employee.model.Department@7eb1cc87
  id=9
  Exception in thread "main" java.lang.NumberFormatException: For input string: ""
      at java.lang.NumberFormatException.forInputString(Unknown Source)
      at java.lang.Integer.parseInt(Unknown Source)
      at java.lang.Integer.parseInt(Unknown Source)
      at com.nousinfo.tutorial.employee.dao.impl.DepartmentDAOImpl.autoIncreament(DepartmentDAOImpl.java:113)
      at com.nousinfo.tutorial.employee.dao.impl.DepartmentDAOImpl.getDepartment(DepartmentDAOImpl.java:47)
      at AccessClass.main(AccessClass.java:34)
  </code></pre>