Here you can find the source of toLongLE(byte target[], int offset, int numBytes, long value)
Parameter | Description |
---|---|
numBytes | 1-8 |
value | non-negative |
public static void toLongLE(byte target[], int offset, int numBytes, long value)
//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; } } }