Android Short to Byte Array Convert short2bytes(short val)

Here you can find the source of short2bytes(short val)

Description

shortbytes

Declaration

public static byte[] short2bytes(short val) 

Method Source Code

//package com.java2s;

public class Main {
    public static byte[] short2bytes(short val) {
        byte[] data = new byte[2];

        data[0] = (byte) (val & 0xFF);
        data[1] = (byte) (val >> 8 & 0xFF);

        return data;
    }//from w  w  w.j a va2s.c o  m
}

Related

  1. shortToBytes(short i)
  2. shortToBytes(short number)
  3. shorts2bytesBE(short[] val)
  4. shorts2bytesLE(short[] val)
  5. getBytes(short data)