Here you can find the source of toInteger(Object obj)
Parameter | Description |
---|---|
obj | the object to be converted |
public static int toInteger(Object obj)
//package com.java2s; public class Main { /**/*from w ww. jav a 2 s .com*/ * Get the integer value of this object, only if the object is an instance of Number * * @param obj the object to be converted * @return the integer value of the object, or 0 if it is not a number. */ public static int toInteger(Object obj) { return (obj instanceof Number) ? ((Number) obj).intValue() : 0; } }