Here you can find the source of fromLongLE(byte src[], int offset, int numBytes)
Parameter | Description |
---|---|
numBytes | 1-8 |
Parameter | Description |
---|---|
AIOOBE | an exception |
IllegalArgumentException | if negative (only possible if numBytes = 8) |
public static long fromLongLE(byte src[], int offset, int numBytes)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from www . j a v a 2 s . c om*/ * Little endian, i.e. backwards. Not for use in I2P protocols. * * @param numBytes 1-8 * @return non-negative * @throws AIOOBE * @throws IllegalArgumentException if negative (only possible if numBytes = 8) * @since 0.8.12 */ public static long fromLongLE(byte src[], int offset, int numBytes) { if (numBytes <= 0 || numBytes > 8) throw new IllegalArgumentException("Invalid number of bytes"); long rv = 0; for (int i = offset + numBytes - 1; i >= offset; i--) { rv <<= 8; rv |= src[i] & 0xFF; } if (rv < 0) throw new IllegalArgumentException( "wtf, fromLong got a negative? " + rv + ": offset=" + offset + " numBytes=" + numBytes); return rv; } }