Put the source <i>long</i> into the destination byte array starting at the given offset
in big endian order.
There is no bounds checking.
@param array destination byte array
@param offset destination starting point
@param value source <i>long</i>
555450
public static void putLongBE(final byte[] array, final int offset, final long value) {
    array[offset + 7] = (byte) (value       );
    array[offset + 6] = (byte) (value >>>  8);
    array[offset + 5] = (byte) (value >>> 16);
    array[offset + 4] = (byte) (value >>> 24);
    array[offset + 3] = (byte) (value >>> 32);
    array[offset + 2] = (byte) (value >>> 40);
    array[offset + 1] = (byte) (value >>> 48);
    array[offset    ] = (byte) (value >>> 56);
  }
1069849
public function writeLong($value)
    {
        // We do not need to check if file position points to the end of "file".
        // Only append operation is supported now

        /**
         * Check, that we work in 64-bit mode.
         * fseek() and ftell() use long for offset. Thus, largest index segment file size in 32bit mode is 2Gb
         */
        if (PHP_INT_SIZE > 4) {
            settype($value, 'integer');
            $this->_data .= chr($value>>56 & 0xFF) .
                            chr($value>>48 & 0xFF) .
                            chr($value>>40 & 0xFF) .
                            chr($value>>32 & 0xFF) .
                            chr($value>>24 & 0xFF) .
                            chr($value>>16 & 0xFF) .
                            chr($value>>8  & 0xFF) .
                            chr($value     & 0xFF);
        } else {
            $this->writeLong32Bit($value);
        }

        $this->_position = strlen($this->_data);
    }
987566
public static byte[] toUnsignedByteArray(BigInteger value) {
		byte[] bytes = value.toByteArray();

		if (bytes[0] == 0) {
			byte[] tmp = new byte[bytes.length - 1];
			System.arraycopy(bytes, 1, tmp, 0, tmp.length);

			return tmp;
		}

		return bytes;
	}
234037
public void set(long index, T value)
    {
        array[segment(index)][offset(index)] = value;
    }
1340928
public static byte[] toUnsignedByteArray(int length, BigInteger value) {
		byte[] bytes = value.toByteArray();
		if (bytes.length == length) {
			return bytes;
		}

		int start = bytes[0] == 0 ? 1 : 0;
		int count = bytes.length - start;

		if (count > length) {
			throw new IllegalArgumentException("standard length exceeded for value");
		}

		byte[] tmp = new byte[length];
		System.arraycopy(bytes, start, tmp, tmp.length - count, count);
		return tmp;
	}
1026150
@Override
	protected synchronized void read(long offset, byte[] b) throws IOException {
		if (byteBuffer != null) {
			byteBuffer.position((int) offset);
			byteBuffer.get(b);
		} else {
			throw new IOException("Read failed, file " + getPath() + " not mapped for I/O");
		}
	}
1222548
public static void putByteBuffer(ByteBuffer source, ByteBuffer target) {
        if (source.hasArray()) {
            byte[] array = source.array();
            int arrayOffset = source.arrayOffset();
            target.put(array, arrayOffset + source.position(), source.remaining());
        }
        else {
            target.put(source.duplicate());
        }
    }
1247498
public static void putDoubleLE(final byte[] array, final int offset, final double value) {
    putLongLE(array, offset, Double.doubleToRawLongBits(value));
  }
1177167
private static void putLong(byte[] array, long l, int pos, int numberOfLongBytes) {
    for (int i = 0; i < numberOfLongBytes; ++i) {
      array[pos + numberOfLongBytes - i - 1] = (byte) (l >>> (i * 8));
    }
  }
344966
public static ByteBuf copyLong(long value) {
        ByteBuf buf = buffer(8);
        buf.writeLong(value);
        return buf;
    }
722617
public static void writeInt64(final long value, final byte[] buffer, int offset)
    {
        buffer[offset++] = (byte) (value >>> 56);
        buffer[offset++] = (byte) (value >>> 48);
        buffer[offset++] = (byte) (value >>> 40);
        buffer[offset++] = (byte) (value >>> 32);
        buffer[offset++] = (byte) (value >>> 24);
        buffer[offset++] = (byte) (value >>> 16);
        buffer[offset++] = (byte) (value >>> 8);
        buffer[offset] = (byte) (value >>> 0);
    }
1228626
public void writeSmallLongArray( long[] values ) {
        int byteSize = values.length * 8 + 1;
        this.addUnsignedByte( ( short ) values.length );
        doWriteLongArray( values, byteSize );
    }
249635
void setOffset(long value) {
        if (this.pointer != null && this.offset.get() != this.pointer.getOffset()) {
            // We have already assigned an offset to this.
            throw new IllegalStateException("Cannot assign offset more than once.");
        }

        this.offset.set(value);
    }
513413
public static void putShortLE(final byte[] array, final int offset, final short value) {
    array[offset    ] = (byte) (value       );
    array[offset + 1] = (byte) (value >>>  8);
  }
176069
public void setLong(int index, long value)
    {
        checkIndexLength(index, SizeOf.SIZE_OF_LONG);
        unsafe.putLong(base, address + index, value);
    }
502804
public static void writeLongBigEndian(byte[] buffer, int offset, long value) {
		buffer[offset++] = (byte)((value >> 56) & 0xFF);
		buffer[offset++] = (byte)((value >> 48) & 0xFF);
		buffer[offset++] = (byte)((value >> 40) & 0xFF);
		buffer[offset++] = (byte)((value >> 32) & 0xFF);
		buffer[offset++] = (byte)((value >> 24) & 0xFF);
		buffer[offset++] = (byte)((value >> 16) & 0xFF);
		buffer[offset++] = (byte)((value >> 8) & 0xFF);
		buffer[offset] = (byte)(value & 0xFF);
	}
811578
public static long readLong(byte b[], int offset) {
    long retValue;

    retValue = ((long)b[offset++]) << 56;
    retValue |= ((long)b[offset++] & 0xff) << 48;
    retValue |= ((long)b[offset++] & 0xff) << 40;
    retValue |= ((long)b[offset++] & 0xff) << 32;
    retValue |= ((long)b[offset++] & 0xff) << 24;
    retValue |= ((long)b[offset++] & 0xff) << 16;
    retValue |= ((long)b[offset++] & 0xff) << 8;
    retValue |= (long)b[offset] & 0xff;

    return retValue;
  }