Java Long Number From toLongLE(byte target[], int offset, int numBytes, long value)

Here you can find the source of toLongLE(byte target[], int offset, int numBytes, long value)

Description

Little endian, i.e.

License

Open Source License

Parameter

Parameter Description
numBytes 1-8
value non-negative

Declaration

public static void toLongLE(byte target[], int offset, int numBytes, long value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*  ww w.  j a va  2  s  .c om*/
     * Little endian, i.e. backwards. Not for use in I2P protocols.
     *
     * @param numBytes 1-8
     * @param value non-negative
     * @since 0.8.12
     */
    public static void toLongLE(byte target[], int offset, int numBytes, long value) {
        if (numBytes <= 0 || numBytes > 8)
            throw new IllegalArgumentException("Invalid number of bytes");
        if (value < 0)
            throw new IllegalArgumentException("Negative value not allowed");
        int limit = offset + numBytes;
        for (int i = offset; i < limit; i++) {
            target[i] = (byte) value;
            value >>= 8;
        }
    }
}

Related

  1. toLongExactWithoutOverflow(float value)
  2. toLongId(Integer i)
  3. toLongInt(byte[] b)
  4. toLongitude(long fsuipcLongitude)
  5. toLongitude(String latLng)
  6. toLongList(String valus)
  7. toLongMatrix(Number[][] matrix)
  8. toLongMin(double[] in, long[] out)
  9. toLongObject(Object obj)