Here you can find the source of toInteger(Object obj)
static Integer toInteger(Object obj)
//package com.java2s; public class Main { static Integer toInteger(Object obj) { if (obj instanceof String) return Integer.parseInt((String) obj); if (obj instanceof Byte) { Byte b = (Byte) obj; return b.intValue(); }/* w w w.j av a 2 s . c om*/ if (obj instanceof Short) { Short s = (Short) obj; return s.intValue(); } return (Integer) obj; } }