Java Object Array Convert To convertObjectToInt(Object value)

Here you can find the source of convertObjectToInt(Object value)

Description

convert Object To Int

License

Open Source License

Declaration

public static int convertObjectToInt(Object value) 

Method Source Code

//package com.java2s;

public class Main {
    public static int convertObjectToInt(Object value) {
        if (value != null) {
            if (value instanceof Integer) {
                return ((Integer) value).intValue();
            } else {
                return Integer.valueOf(value.toString()).intValue();
            }// ww w . j av a 2s  .  c  o  m
        } else {
            throw new NullPointerException("Property value was null so it couldn't be converted to an int.");
        }
    }
}

Related

  1. convertObject(final Object obj, final Class clazz)
  2. convertObjectArrayToByte(Object[] array)
  3. convertObjectGUIToByteString(byte[] objectGUID)
  4. convertObjectToBean(Object obj, Class clazz)
  5. convertObjectToBoolean(Object value)
  6. convertObjectToIntegerIfNecessary(final Object configValue)
  7. convertObjectToSqlSyntaxe(Object value)
  8. objectArrayToIntArray(Object[] objectArray)
  9. objectArrayToObjectArray(Object[] objArray)