Here you can find the source of cast(int value)
public static short cast(int value)
//package com.java2s; //License from project: Open Source License public class Main { public static short cast(int value) { return value > Short.MAX_VALUE ? Short.MAX_VALUE : value < Short.MIN_VALUE ? Short.MIN_VALUE : (short) value; }/* w w w .j av a 2s . co m*/ public static short cast(long value) { return value > Short.MAX_VALUE ? Short.MAX_VALUE : value < Short.MIN_VALUE ? Short.MIN_VALUE : (short) value; } }