Here you can find the source of toNumber(String value, int defValue)
static int toNumber(String value, int defValue)
//package com.java2s; // See LICENSE.txt for license information public class Main { /** Convenience method for converting a String into an Integer. */ static int toNumber(String value, int defValue) { if (value != null) { try { return Integer.parseInt(value); } catch (NumberFormatException e) { }/*from ww w. j a v a 2s. c om*/ } return defValue; } }