Java Object Type Case cast(int value)

Here you can find the source of cast(int value)

Description

cast

License

Open Source License

Declaration


public static short cast(int value) 

Method Source Code

//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;
    }
}

Related

  1. cast(final Number number, final Class returnType)
  2. cast(final Object o)
  3. cast(final Object obj, final Class type)
  4. cast(final Object object)
  5. cast(final Object original)
  6. cast(int value)
  7. cast(long value)
  8. cast(Object inValue)
  9. cast(Object o)