Java Long to Byte longToByte(long i_Value)

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

Description

long To Byte

License

Open Source License

Declaration

public static byte[] longToByte(long i_Value) 

Method Source Code

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

public class Main {

    public static byte[] longToByte(long i_Value) {
        byte[] v_Ret = new byte[8];

        v_Ret[0] = (byte) ((i_Value >>> 56) & 0xFF);
        v_Ret[1] = (byte) ((i_Value >>> 48) & 0xFF);
        v_Ret[2] = (byte) ((i_Value >>> 40) & 0xFF);
        v_Ret[3] = (byte) ((i_Value >>> 32) & 0xFF);
        v_Ret[4] = (byte) ((i_Value >>> 24) & 0xFF);
        v_Ret[5] = (byte) ((i_Value >>> 16) & 0xFF);
        v_Ret[6] = (byte) ((i_Value >>> 8) & 0xFF);
        v_Ret[7] = (byte) ((i_Value >>> 0) & 0xFF);

        return v_Ret;
    }// w w  w  .j  ava  2s. c o  m
}

Related

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