Java Convert via ByteBuffer longToBytes(long x)

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

Description

long To Bytes

License

Apache License

Declaration

public static byte[] longToBytes(long x) 

Method Source Code

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

import java.nio.ByteBuffer;

public class Main {
    public static byte[] longToBytes(long x) {
        byte[] payload = ByteBuffer.allocate(8).putLong(x).array();
        return payload;
    }/*www .  ja  v a2s  . co  m*/
}

Related

  1. longToByteArray(long[] array)
  2. longToBytes(final long value)
  3. longToBytes(long aLong)
  4. longToBytes(long l)
  5. longToBytes(long l, int size)
  6. longToBytes(long x, byte[] dest, int offset)
  7. longToBytesNoLeadZeroes(long val)
  8. longToFourBytesFlip(long l)
  9. longToHeight(long x)