Here you can find the source of asInt(String str, int defaultValue)
public static int asInt(String str, int defaultValue)
//package com.java2s; //License from project: Apache License public class Main { public static int asInt(String str, int defaultValue) { try {//from w w w. j a va 2 s. c o m return Integer.parseInt(str); } catch (Exception e) { return defaultValue; } } }