Here you can find the source of toInteger(Object o)
public static Integer toInteger(Object o)
//package com.java2s; public class Main { public static Integer toInteger(Object o) { Integer i;/*from w w w . ja v a 2 s .c om*/ if (o instanceof Integer) { i = (Integer) o; } else { try { i = Integer.valueOf(o.toString()); } catch (Exception e) { i = null; } } return i; } }