Java Object to int objToInteger(Object obj)

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

Description

obj To Integer

License

Open Source License

Declaration

public static Integer objToInteger(Object obj) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {

    public static Integer objToInteger(Object obj) {
        Integer result = 0;// w ww. j  a va2 s.  c o m
        try {
            result = Integer.valueOf(obj.toString());
        } catch (Exception e) {
            result = null;
        }
        return result;
    }
}

Related

  1. castToInteger(Object object)
  2. castToInteger(Object value)
  3. castToIntegerArray(Object[] array)
  4. castToInts(final double[] doubles)
  5. objToInt(Object obj)