Java Integer to Short intToShort(int i)

Here you can find the source of intToShort(int i)

Description

int To Short

License

LGPL

Declaration

public static Short intToShort(int i) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static Short intToShort(int i) {
        if (i >= Short.MIN_VALUE && i <= Short.MAX_VALUE) {
            return (short) i;
        }//www.  j  a v a2 s.c  o  m
        return null;
    }

    public static short intToShort(int i, short defaultValue) {
        if (i >= Short.MIN_VALUE && i <= Short.MAX_VALUE) {
            return (short) i;
        }
        return defaultValue;
    }
}

Related

  1. convertIntegerToShort(Integer intValue)
  2. intToShort(int[] values)
  3. intToShortArray(final int intValue)
  4. intToShortBytes(int a)
  5. intToShorts(int n)