Java Byte Array Create toBytes(long input)

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

Description

to Bytes

License

Apache License

Declaration

private static byte[] toBytes(long input) 

Method Source Code

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

public class Main {
    private static byte[] toBytes(long input) {
        byte[] output = new byte[4];
        for (int i = 0; i < output.length; i++) {
            output[i] = (byte) ((input >>> (i * 8)) & 0xff);//big-endian
        }/*from  w  ww  . j a v  a 2s.c  o  m*/
        return output;
    }
}

Related

  1. toBytes(int value)
  2. toBytes(int value)
  3. toBytes(int value, byte[] dest, int destPos)
  4. toBytes(int x, byte[] out)
  5. toBytes(int[] ints)
  6. toBytes(long l)
  7. toBytes(long l, byte[] bytes, int offset, int limit)
  8. toBytes(long lp)
  9. toBytes(long n)