Java Short to Byte Array fromShort(short key)

Here you can find the source of fromShort(short key)

Description

from Short

License

BSD License

Declaration

public static byte[] fromShort(short key) 

Method Source Code

//package com.java2s;
// BSD License (http://lemurproject.org/galago-license)

public class Main {
    public static byte[] fromShort(short key) {
        byte[] writeBuffer = new byte[2];
        writeBuffer[0] = (byte) ((key >>> 8) & 0xFF);
        writeBuffer[1] = (byte) key;
        return writeBuffer;
    }//  w w  w  .  j  a  v  a  2s  .c o  m
}

Related

  1. fromShort(int shortValue)
  2. fromShort(short input)
  3. fromShort(short number)
  4. fromShort(short value)