/** * Translates up to the first 8 bytes of a byte array to a long. * If there are fewer than 8 bytes available, the MSBs are all * assumed to be zero (regardless of endianness). * * @param bytes array of bytes to be translated to a long * @param little true if the bytes are provided in little-endian order * @return the long value that results from concatenating the specified bytes */ public static long bytesToLong(byte[] bytes, boolean little) { return bytesToLong(bytes, 0, 8, little); }
/** * Translates up to the first 8 bytes of a byte array to a long. * If there are fewer than 8 bytes available, the MSBs are all * assumed to be zero (regardless of endianness). */ public static long bytesToLong(byte[] bytes, boolean little) { return bytesToLong(bytes, 0, 8, little); }
/** * Translates up to the first 8 bytes of a byte array beyond the given * offset to a long. If there are fewer than 8 bytes available, * the MSBs are all assumed to be zero (regardless of endianness). */ public static long bytesToLong(short[] bytes, int off, boolean little) { return bytesToLong(bytes, off, 8, little); }
/** * Translates up to the first 8 bytes of a byte array beyond the given * offset to a long. If there are fewer than 8 bytes available, * the MSBs are all assumed to be zero (regardless of endianness). */ public static long bytesToLong(byte[] bytes, int off, boolean little) { return bytesToLong(bytes, off, 8, little); }
/** * Translates up to the first 8 bytes of a byte array to a long. * If there are fewer than 8 bytes available, the MSBs are all * assumed to be zero (regardless of endianness). */ public static long bytesToLong(short[] bytes, boolean little) { return bytesToLong(bytes, 0, 8, little); }
/** * Private method used to retrieve a Long value from the SPE header * @param index The index of the expected value in the header array * @return The value read at the given header entry location */ private long getLong(int index) { return DataTools.bytesToLong(header, index, true); }
/** * Translates up to the first 8 bytes of a byte array to a long. * If there are fewer than 8 bytes available, the MSBs are all * assumed to be zero (regardless of endianness). * * @param bytes array of unsigned bytes to be translated to a long * @param little true if the bytes are provided in little-endian order * @return the long value that results from concatenating the specified bytes */ public static long bytesToLong(short[] bytes, boolean little) { return bytesToLong(bytes, 0, 8, little); }
/** * Private method used to retrieve a Long value from the SPE header * @param index The index of the expected value in the header array * @return The value read at the given header entry location */ private long getLong(int index) { return DataTools.bytesToLong(header, index, true); }
/** * Translates up to the first 8 bytes of a byte array beyond the given * offset to a long. If there are fewer than 8 bytes available, * the MSBs are all assumed to be zero (regardless of endianness). * * @param bytes array of unsigned bytes to be translated to a long * @param off offset to the first byte in the array * @param little true if the bytes are provided in little-endian order * @return the long value that results from concatenating the specified bytes */ public static long bytesToLong(short[] bytes, int off, boolean little) { return bytesToLong(bytes, off, 8, little); }
/** * Translates up to the first 8 bytes of a byte array beyond the given * offset to a long. If there are fewer than 8 bytes available, * the MSBs are all assumed to be zero (regardless of endianness). * * @param bytes array of bytes to be translated to a long * @param off offset to the first byte in the array * @param little true if the bytes are provided in little-endian order * @return the long value that results from concatenating the specified bytes */ public static long bytesToLong(byte[] bytes, int off, boolean little) { return bytesToLong(bytes, off, 8, little); }
/** * Translates up to the first len bytes of a byte array beyond the given * offset to a double. If there are fewer than len bytes available, * the MSBs are all assumed to be zero (regardless of endianness). */ public static double bytesToDouble(short[] bytes, int off, int len, boolean little) { return Double.longBitsToDouble(bytesToLong(bytes, off, len, little)); }
/** * Translates up to the first len bytes of a byte array beyond the given * offset to a double. If there are fewer than len bytes available, * the MSBs are all assumed to be zero (regardless of endianness). */ public static double bytesToDouble(byte[] bytes, int off, int len, boolean little) { return Double.longBitsToDouble(bytesToLong(bytes, off, len, little)); }
/** * Translates up to the first len bytes of a byte array beyond the given * offset to a double. If there are fewer than len bytes available, * the MSBs are all assumed to be zero (regardless of endianness). * * @param bytes array of bytes to be translated to a double * @param off offset to the first byte in the array * @param len number of bytes to use * @param little true if the bytes are provided in little-endian order * @return the double value that results from concatenating the specified bytes */ public static double bytesToDouble(byte[] bytes, int off, int len, boolean little) { return Double.longBitsToDouble(bytesToLong(bytes, off, len, little)); }
/** * Translates up to the first len bytes of a byte array beyond the given * offset to a double. If there are fewer than len bytes available, * the MSBs are all assumed to be zero (regardless of endianness). * * @param bytes array of unsigned bytes to be translated to a double * @param off offset to the first byte in the array * @param len number of bytes to use * @param little true if the bytes are provided in little-endian order * @return the double value that results from concatenating the specified bytes */ public static double bytesToDouble(short[] bytes, int off, int len, boolean little) { return Double.longBitsToDouble(bytesToLong(bytes, off, len, little)); }
for (int x=0; x<width; x++) { int index = 8 * (width * y + x); l[y][x] = bytesToLong(b, index, 8, little);
for (int x=0; x<width; x++) { int index = 8 * (width * y + x); l[y][x] = bytesToLong(b, index, 8, little);
long[] l = new long[b.length / 8]; for (int i=0; i<l.length; i++) { l[i] = bytesToLong(b, i * 8, 8, little);
long[] l = new long[b.length / 8]; for (int i=0; i<l.length; i++) { l[i] = bytesToLong(b, i * 8, 8, little);
for (int c=0; c<numRGB; c++) { int idx = bpp * (interleaved ? i * numRGB + c : c * pixels + i); long bits = DataTools.bytesToLong(buf, idx, bpp, little); if (signed) { if (bits >= threshold) bits -= 2*threshold;
for (int c=0; c<numRGB; c++) { int idx = bpp * (interleaved ? i * numRGB + c : c * pixels + i); long bits = DataTools.bytesToLong(buf, idx, bpp, little); if (signed) { if (bits >= threshold) bits -= 2*threshold;