Here you can find the source of toInteger(Object object)
public static Integer toInteger(Object object)
//package com.java2s; //License from project: Open Source License public class Main { public static Integer toInteger(Object object) { Integer integerValue;//from ww w.ja v a2 s .c o m if (object instanceof String) { integerValue = Integer.valueOf((String) object); } else if (object instanceof Number) { integerValue = ((Number) object).intValue(); } else if (object == null) { integerValue = null; } else { throw new IllegalArgumentException("Failed to convert " + object.getClass().getName() + " [" + object + "] to an Integer."); } return integerValue; } }