Java Long to Byte Array longToBytes(long value, byte[] buffer, int bufferStartPosition)

Here you can find the source of longToBytes(long value, byte[] buffer, int bufferStartPosition)

Description

long To Bytes

License

Open Source License

Declaration

public static void longToBytes(long value, byte[] buffer, int bufferStartPosition) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static void longToBytes(long value, byte[] buffer, int bufferStartPosition) {
        int endPos = bufferStartPosition + 8;
        for (int idx = bufferStartPosition; idx < endPos; idx++) {
            buffer[idx] = (byte) (value & 0xFF);
            value = value >> 8;//  w w w  .jav a  2 s  . c  o m
        }
    }
}

Related

  1. longToBytes(long v, final byte[] arr)
  2. longToBytes(long val)
  3. longToBytes(long val)
  4. longToBytes(long value)
  5. longToBytes(long value, byte[] array, int offset)
  6. longToBytes(long value, byte[] buffer, int offset)
  7. LongToBytes4(long l, byte abyte0[])
  8. LongToBytes8(long l)
  9. LongToBytesLE(final long val)