Android Long to Byte Array Convert longToBytes(long x)

Here you can find the source of longToBytes(long x)

Description

long To Bytes

Declaration

public static byte[] longToBytes(long x) 

Method Source Code

//package com.java2s;

import java.nio.ByteBuffer;

public class Main {
    private static ByteBuffer buffer = ByteBuffer.allocate(8);

    public static byte[] longToBytes(long x) {
        buffer.clear();/*from www . j a  va 2s.  co  m*/
        buffer.putLong(0, x);
        return buffer.array();
    }
}

Related

  1. longFitsIn(final long value)
  2. longToByteArray(long a)
  3. longToByteArray(long l)
  4. longToByteArray(long value)
  5. longToBytes(long l)
  6. longs2bytesBE(long[] val)
  7. longs2bytesLE(long[] val)
  8. toBytes(long value)
  9. toBytes(long value, byte[] dest, int destPos)