Here you can find the source of objectToShort(Object o)
public static final short objectToShort(Object o)
//package com.java2s; //License from project: Apache License public class Main { public static final short objectToShort(Object o) { if (o instanceof Number) return ((Number) o).shortValue(); try {// w w w .j ava 2 s. com if (o == null) return -1; else return Short.parseShort(o.toString()); } catch (NumberFormatException e) { return -1; } } }