Here you can find the source of toInt(Object num, int defValue)
public static int toInt(Object num, int defValue)
//package com.java2s; //License from project: LGPL public class Main { public static int toInt(Object num, int defValue) { if (num != null) { String value = String.valueOf(num); try { return Integer.parseInt(value); } catch (Exception e) { }//from w w w.ja va 2s.c o m } return defValue; } }