Java Integer to Byte Array IntToBytesLE(final long val)

Here you can find the source of IntToBytesLE(final long val)

Description

Int To Bytes LE

License

Creative Commons License

Declaration

public final static byte[] IntToBytesLE(final long val) 

Method Source Code

//package com.java2s;
//License from project: Creative Commons License 

public class Main {
    public final static byte[] IntToBytesLE(final long val) {
        byte[] buf = new byte[4];

        for (int i = 0; i < 4; i++) {
            buf[i] = (byte) (val >>> (8 * i));
        }//from ww w  .j av  a 2s. c o m

        return buf;
    }
}

Related

  1. intToBytes16(int sample, byte[] buffer, int byteOffset, boolean bigEndian)
  2. IntToBytes4(int i)
  3. intToBytesBE(int value, byte[] buffer)
  4. intToBytesBigend(int value)
  5. intToBytesBigEndian(int n)
  6. intToBytesLE(int i, byte[] bytes, int off)
  7. intToBytesLE(int value, byte[] buffer, int offset, int length)
  8. intToBytesLittleEndian(final int i, final byte[] dest, final int offset)
  9. intToBytesNoLeadZeroes(int val)