Here you can find the source of objectToInt(Object val)
Parameter | Description |
---|---|
val | returns the value of Shorts and Integers as an int. VPF null values get returned as Integer.MIN_VALUE, as do all other types |
public static final int objectToInt(Object val)
//package com.java2s; public class Main { /**//from www .j a va 2s . co m * get the value contained in the object. * * @param val returns the value of Shorts and Integers as an int. VPF null * values get returned as Integer.MIN_VALUE, as do all other types * @return the value contained in val */ public static final int objectToInt(Object val) { int v = Integer.MIN_VALUE; if (val instanceof Integer) { v = ((Integer) val).intValue(); if (v == Integer.MIN_VALUE + 1) { v = Integer.MIN_VALUE; } } else if (val instanceof Short) { v = ((Short) val).shortValue(); if (v == Short.MIN_VALUE + 1) { v = Integer.MIN_VALUE; } } return v; } }