Java Long to Byte Array longToByteArray(long i64)

Here you can find the source of longToByteArray(long i64)

Description

long To Byte Array

License

Apache License

Declaration

public static byte[] longToByteArray(long i64) 

Method Source Code

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

public class Main {
    private static byte[] i64out = new byte[8];

    public static byte[] longToByteArray(long i64) {
        i64out[0] = (byte) (0xff & (i64 >> 56));
        i64out[1] = (byte) (0xff & (i64 >> 48));
        i64out[2] = (byte) (0xff & (i64 >> 40));
        i64out[3] = (byte) (0xff & (i64 >> 32));
        i64out[4] = (byte) (0xff & (i64 >> 24));
        i64out[5] = (byte) (0xff & (i64 >> 16));
        i64out[6] = (byte) (0xff & (i64 >> 8));
        i64out[7] = (byte) (0xff & (i64));
        return i64out;
    }/*from  w ww.j  a  v  a  2 s.co  m*/
}

Related

  1. longToByteArray(final long l)
  2. longToByteArray(final long v, final byte[] buf, final int offset)
  3. longToByteArray(final long val, final byte[] buf, final int offset)
  4. longToByteArray(final long value, final int size)
  5. longToByteArray(long a, byte[] buf)
  6. longToByteArray(long in)
  7. longToByteArray(long input)
  8. longToByteArray(long l)
  9. longToByteArray(long l)