Java Integer Create toInt(Object num, int defValue)

Here you can find the source of toInt(Object num, int defValue)

Description

to Int

License

LGPL

Declaration

public static int toInt(Object num, int defValue) 

Method Source Code

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

public class Main {
    public static int toInt(Object num, int defValue) {
        if (num != null) {
            String value = String.valueOf(num);
            try {
                return Integer.parseInt(value);
            } catch (Exception e) {
            }//from   w  w w.ja va  2s.c o m
        }
        return defValue;
    }
}

Related

  1. toInt(Number num)
  2. toInt(Number value)
  3. toInt(Number wrapped)
  4. toInt(Object bean, int defaultValue)
  5. toInt(Object num)
  6. toInt(Object o)
  7. toInt(Object o, int defaultValue)
  8. toInt(Object obj)
  9. toInt(Object obj)