Here you can find the source of longToShorts(long n)
public static short[] longToShorts(long n)
//package com.java2s; public class Main { public static short[] longToShorts(long n) { return longToShorts(n, new short[4], 0); }/* w w w .j a v a2s . c om*/ public static short[] longToShorts(long n, short[] arr, int off) { for (int i = 0; i < arr.length; i++) { arr[i + off] = (short) (n >> 16 * i & 0xFFFF); } return arr; } }