Here you can find the source of toShort(Object obj)
Parameter | Description |
---|---|
obj | the object to be converted |
public static short toShort(Object obj)
//package com.java2s; public class Main { /**/*from w w w. j ava 2 s .co m*/ * Get the short value of this object, only if the object is an instance of Number * * @param obj the object to be converted * @return the short value of the object, or 0 if it is not a number. */ public static short toShort(Object obj) { return (obj instanceof Number) ? ((Number) obj).shortValue() : 0; } }