Here you can find the source of intToShorts(int n)
public static short[] intToShorts(int n)
//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; } }