Java Long to Short longToShorts(long n)

Here you can find the source of longToShorts(long n)

Description

long To Shorts

License

Open Source License

Declaration

public static short[] longToShorts(long n) 

Method Source Code

//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;
    }
}

Related

  1. long2short(long l)
  2. longToShort(final long value)
  3. longToShort(long l)
  4. longToShort(long[] values)
  5. longToShortBounds(long value)
  6. longToShorts(long value)