Here you can find the source of convertStringToInt(String str, int failValue)
public static int convertStringToInt(String str, int failValue)
//package com.java2s; public class Main { public static int convertStringToInt(String str) { return convertStringToInt(str, 0); }/*from ww w . j a v a 2 s . c o m*/ public static int convertStringToInt(String str, int failValue) { if (str == null) { return failValue; } try { return Integer.parseInt(str); } catch (Exception e) { e.printStackTrace(); } return failValue; } }