Java Long to Byte longToByte(long i)

Here you can find the source of longToByte(long i)

Description

long To Byte

License

Open Source License

Declaration

public static byte[] longToByte(long i) 

Method Source Code

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

public class Main {

    public static byte[] longToByte(long i) {
        return numberToByte(i, 8);
    }/*  w w w.  j  ava  2  s. co  m*/

    private static byte[] numberToByte(long l, int length) {
        byte[] bts = new byte[length];
        for (int i = 0; i < length; i++) {
            bts[i] = (byte) (l >> ((length - i - 1) * 8));
        }
        return bts;
    }
}

Related

  1. long2byte(long l)
  2. long2byte(long l)
  3. longToByte(byte[] buf, int off, long value)
  4. longToByte(final long value)
  5. longToByte(long a_value)
  6. longToByte(long i_Value)
  7. longToByte(long l)
  8. longToByte(long l)
  9. longToByte(long l)