Android Long to Byte Array Convert long2bytes(long num)

Here you can find the source of long2bytes(long num)

Description

longbytes

License

Apache License

Declaration

public static byte[] long2bytes(long num) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static byte[] long2bytes(long num) {
        byte[] b = new byte[8];
        for (int i = 0; i < 8; i++) {
            b[i] = (byte) (num >>> (56 - i * 8));
        }/*ww  w  .  j a v  a2s.c o m*/
        return b;
    }
}

Related

  1. uint32ToByteArrayLE(long value, byte[] output, int offset)
  2. uint64ToByteArrayLE(long value, byte[] output, int offset)
  3. long2byteArray(final long number, final int length, final boolean swapHalfWord)
  4. long2bytes(long val)
  5. convertToByteArray(long l)
  6. toBytes(long longValue)
  7. ulong2bytes(long value)
  8. longToBytes(long data, int n)