Here you can find the source of toInt(Object obj)
Parameter | Description |
---|---|
obj | Object to be convert. |
public static int toInt(Object obj)
//package com.java2s; /*L//from w ww .j a v a2 s.c o m * Copyright Washington University in St. Louis, SemanticBits, Persistent Systems, Krishagni. * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/commons-module/LICENSE.txt for details. */ public class Main { /** * This method convert object to int. * @param obj Object to be convert. * @return int value. */ public static int toInt(Object obj) { int value = 0; if (obj != null) { String objVal = String.valueOf(obj); if (objVal.length() > 0) { Integer intObj = Integer.parseInt(objVal); value = intObj.intValue(); } } return value; } }