Here you can find the source of toInt(Object obj)
public static int toInt(Object obj)
//package com.java2s; //License from project: Open Source License public class Main { public static int toInt(Object obj) { String str = obj != null ? obj.toString().trim() : ""; return "".equals(str) ? 0 : Integer.parseInt(str); }/*from www . ja v a 2s . c o m*/ public static int toInt(Object obj, int intStr) { String str = obj != null ? obj.toString().trim() : ""; return "".equals(str) ? intStr : Integer.parseInt(str); } public static String toString(Object obj) { return obj != null ? obj.toString() : ""; } public static String toString(Object obj, String str) { return obj != null ? obj.toString() : str; } }