Java Integer to Short intToShorts(int n)

Here you can find the source of intToShorts(int n)

Description

int To Shorts

License

Open Source License

Declaration

public static short[] intToShorts(int n) 

Method Source Code

//package com.java2s;

public class Main {
    public static short[] intToShorts(int n) {
        return intToShorts(n, new short[2], 0);
    }/*from w  w w.  j  a v  a  2 s .c  o m*/

    public static short[] intToShorts(int n, short[] bs, int off) {
        for (int i = 0; i < 2; i++) {
            bs[i + off] = (short) (n >> 16 * i & 0xFFFF);
        }

        return bs;
    }
}

Related

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