Java Utililty Methods Integer to Short

List of utility methods to do Integer to Short

Description

The list of methods to do Integer to Short are organized into topic(s).

Method

ShortconvertIntegerToShort(Integer intValue)
convert Integer To Short
if (intValue == null) {
    return null;
return intValue.shortValue();
ShortintToShort(int i)
int To Short
if (i >= Short.MIN_VALUE && i <= Short.MAX_VALUE) {
    return (short) i;
return null;
short[]intToShort(int[] values)
int To Short
if (values == null) {
    return null;
short[] results = new short[values.length];
for (int i = 0; i < values.length; i++) {
    results[i] = (short) values[i];
return results;
...
short[]intToShortArray(final int intValue)
Converts an int value to a 4-byte length short array.
final short[] result = new short[CONST_4];
for (byte i = CONST_4 - 1; i >= 0; --i) {
    result[i] |= ((intValue >>> CONST_8 * ((CONST_4 - 1) - i)) & (CONST_255));
return result;
byte[]intToShortBytes(int a)
Convert an int value to a 2-byte array.
byte[] returnByteArray = new byte[2]; 
returnByteArray[0] = (byte) ((a & 0x0000ff00) >> 8);
returnByteArray[1] = (byte) ((a & 0x000000ff));
return returnByteArray;
short[]intToShorts(int n)
int To Shorts
return intToShorts(n, new short[2], 0);