Java Integer Create toInt(Object obj)

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

Description

to Int

License

Apache License

Declaration

public static int toInt(Object obj) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static int toInt(Object obj) {
        int a = 0;
        try {/*w  w  w . j a va  2s .  co m*/
            if (obj != null)
                a = Integer.parseInt(obj.toString());
        } catch (Exception e) {

        }
        return a;
    }

    public static String toString(Object obj) {
        if (obj == null)
            return "";

        return obj.toString();
    }
}

Related

  1. toInt(Object o, int defaultValue)
  2. toInt(Object obj)
  3. toInt(Object obj)
  4. toInt(Object obj)
  5. toInt(Object obj)
  6. toInt(Object obj)
  7. toInt(Object obj)
  8. toInt(Object object)
  9. toInt(Object object, int defaultValue)