Convert short To Byte[2] - Android java.lang

Android examples for java.lang:Byte

Description

Convert short To Byte[2]

Demo Code


//package com.java2s;

public class Main {
    public static byte[] shortToByte(short value) {
        byte[] result = new byte[2];

        result[0] = (byte) (value >> 8);
        result[1] = (byte) (value); 
        return result;
    }/* w w w  .  j a  va  2 s.com*/
}

Related Tutorials