Java Byte Array Value Set setBytesFromLong(byte[] ret, long value, int offs)

Here you can find the source of setBytesFromLong(byte[] ret, long value, int offs)

Description

set Bytes From Long

License

Open Source License

Declaration

final static void setBytesFromLong(byte[] ret, long value, int offs) 

Method Source Code

//package com.java2s;

public class Main {
    final static void setBytesFromLong(byte[] ret, long value, int offs) {
        long v = value;
        int j = offs;
        ret[j++] = (byte) ((v >>> 56) & 0xFF);
        ret[j++] = (byte) ((v >>> 48) & 0xFF);
        ret[j++] = (byte) ((v >>> 40) & 0xFF);
        ret[j++] = (byte) ((v >>> 32) & 0xFF);
        ret[j++] = (byte) ((v >>> 24) & 0xFF);
        ret[j++] = (byte) ((v >>> 16) & 0xFF);
        ret[j++] = (byte) ((v >>> 8) & 0xFF);
        ret[j++] = (byte) ((v >>> 0) & 0xFF);
    }//from   w  w w.ja  va 2  s  .c o  m
}

Related

  1. setBytes(final byte[] dest, final byte[] data, final int offset, int length)
  2. setBytes(int value, int offset, byte[] bytes)
  3. setBytes(long value, int offset, byte[] bytes)
  4. setBytes(short value, int offset, byte[] bytes)
  5. setBytesFromInt(byte[] ret, int value, int offs)