Here you can find the source of objectToInt(Object o)
public static final int objectToInt(Object o)
//package com.java2s; //License from project: Apache License public class Main { public static final int objectToInt(Object o) { if (o instanceof Number) return ((Number) o).intValue(); try {// w w w. ja va 2s . com if (o == null) return -1; else return Integer.parseInt(o.toString()); } catch (NumberFormatException e) { return -1; } } }