Convert String to Integer with default value
here is a solution :

int tryParseInt(String value) { 
 try {  
     return Integer.parseInt(value);  
  } catch(NumberFormatException nfe) {  
      // Log exception.
      return 0;
  }  
}


you should catch NumberFormatException instead of exception.