Here you can find the source of toInt(Object obj)
public static int toInt(Object obj)
//package com.java2s; public class Main { public static int toInt(String str, int defValue) { try {//from ww w . j av a2 s. c om return Integer.parseInt(str); } catch (Exception e) { } return defValue; } public static int toInt(Object obj) { if (obj == null) return 0; return toInt(obj.toString(), 0); } }