int Byte Array Little Endian - Android File Input Output

Android examples for File Input Output:Byte Array

Description

int Byte Array Little Endian

Demo Code


//package com.book2s;

public class Main {

    public static byte[] int2ByteArrayLittleEndian(int num) {
        byte[] b = new byte[4];
        b[3] = (byte) (num >>> 24);
        b[2] = (byte) (num >>> 16);
        b[1] = (byte) (num >>> 8);
        b[0] = (byte) num;
        return b;
    }//w  w  w  . j  av a  2 s. com
}

Related Tutorials