Java Convert via ByteBuffer longToLE(long lVal)

Here you can find the source of longToLE(long lVal)

Description

Pack integer value to Little Endian.

License

Open Source License

Declaration

public final static byte[] longToLE(long lVal) 

Method Source Code


//package com.java2s;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class Main {
    /**//ww w. ja  v  a  2 s.  c o m
     * Pack integer value to Little Endian.
     */
    public final static byte[] longToLE(long lVal) {
        ByteBuffer bb = ByteBuffer.allocate(Integer.SIZE / 8);
        bb.order(ByteOrder.LITTLE_ENDIAN);
        bb.putLong(lVal);

        return bb.array();
    }
}

Related

  1. longToBytes(long x, byte[] dest, int offset)
  2. longToBytesNoLeadZeroes(long val)
  3. longToFourBytesFlip(long l)
  4. longToHeight(long x)
  5. longToIPv4(Long ip)
  6. longToShorts2(long value)
  7. shortToByteArray(short inShort)
  8. shortToBytes(short s)
  9. stringsFromBinary(final byte[] binary)