Here you can find the source of toInt(Number num)
public static int toInt(Number num)
//package com.java2s; //License from project: Apache License public class Main { public static int toInt(Number num) { if (num == null) { return 0; } else {/*from w ww . j a v a 2 s . c om*/ return num.intValue(); } } public static int toInt(Number num, int defaultValue) { if (num == null) { return defaultValue; } else { return num.intValue(); } } public static int toInt(boolean flag) { return flag ? 1 : 0; } // @Deprecated public static int toInt(Object num) { if (num == null) { return 0; } else { return Integer.parseInt(num.toString()); } } }