Here you can find the source of objectToInt(Object obj)
public static final int objectToInt(Object obj)
//package com.java2s; public class Main { public static final int objectToInt(Object obj) { if (null == obj) { return 0; }//from w w w. j a v a2s. c o m try { if (obj instanceof String) { return Integer.parseInt((String) obj); } else if (obj instanceof Integer) { return (Integer) obj; } } catch (Exception e) { return 0; } return 0; } }