Here you can find the source of toInteger(String s, int defValue)
public static int toInteger(String s, int defValue)
//package com.java2s; //License from project: Apache License public class Main { public static int toInteger(String s, int defValue) { Integer result = toInteger(s); return ((result != null) ? result.intValue() : defValue); }//from w w w.j av a 2 s . c o m public static Integer toInteger(String s) { if (s != null) try { return Integer.valueOf(s); } catch (NumberFormatException e) { } return null; } }