Java Convert via ByteBuffer toBytes(long l)

Here you can find the source of toBytes(long l)

Description

to Bytes

License

Open Source License

Declaration

public static byte[] toBytes(long l) 

Method Source Code


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

import java.nio.ByteBuffer;

public class Main {
    public static byte[] toBytes(long l) {
        ByteBuffer bb = ByteBuffer.allocate(Long.BYTES);
        bb.putLong(l);//from  w  w w. j  a  v  a  2 s .  c  o m
        return bb.array();
    }
}

Related

  1. toBytes(char[] string)
  2. toBytes(final float val)
  3. toBytes(final UUID uuid)
  4. toBytes(InputStream input)
  5. toBytes(int value)
  6. toBytes(Number value)
  7. toBytes(Object obj)
  8. toBytes(String str, boolean wideChar)
  9. toBytes(String value)