Java Object to Float objectToInt(Object obj)

Here you can find the source of objectToInt(Object obj)

Description

object To Int

License

Open Source License

Declaration

public static final int objectToInt(Object obj) 

Method Source Code

//package com.java2s;

public class Main {

    public static final int objectToInt(Object obj) {
        if (null == obj) {
            return 0;
        }//from  w w  w.  j a  v  a2s.  c o  m
        try {
            if (obj instanceof String) {
                return Integer.parseInt((String) obj);
            } else if (obj instanceof Integer) {
                return (Integer) obj;
            }
        } catch (Exception e) {
            return 0;
        }
        return 0;
    }
}

Related

  1. objectToFloat(Object o)
  2. objectToFloat(Object obj)
  3. objectToInt(Object o)
  4. objectToInt(Object o)
  5. objectToInt(Object Obj)
  6. objectToInt(Object obj)
  7. objectToInt(Object p1)
  8. objectToInt(Object val)