Here you can find the source of toInteger(String value, int defaultValue)
public static int toInteger(String value, int defaultValue)
//package com.java2s; //License from project: Open Source License public class Main { public static int toInteger(String value) { return toInteger(value, 0); }/*from www .j av a 2s . c o m*/ public static int toInteger(String value, int defaultValue) { int valueAsInt = 0; try { valueAsInt = Integer.parseInt(value); } catch (NumberFormatException e) { return defaultValue; } return valueAsInt; } }