code: public static Integer parseInteger(String value) throws ParseException
     {
        Integer result = null;
  
        if (value.length() > 0 && value.indexOf(' ') == -1)
        {
           if (value.indexOf('.') == -1)
           {
              result = Integer.valueOf(value);
           }
           else
           {
              Number n = DatatypeConverter.parseDouble(value);
              result = Integer.valueOf(n.intValue());
           }
        }
  
        return result;
     }
docs: Parse a string representation of an Integer value.
  
  @param value string representation
  @return Integer value