Java Long Number Create convertLong2FourBytes(long data)

Here you can find the source of convertLong2FourBytes(long data)

Description

convert Long Four Bytes

License

Open Source License

Declaration

public static byte[] convertLong2FourBytes(long data) 

Method Source Code

//package com.java2s;

public class Main {

    public static byte[] convertLong2FourBytes(long data) {
        byte[] result = new byte[4];
        result[3] = ((byte) (0xFF & data));
        result[2] = ((byte) ((0xFF00 & data) >> 8));
        result[1] = ((byte) ((0xFF0000 & data) >> 16));
        result[0] = ((byte) ((0xFF000000 & data) >> 24));
        return result;
    }//from   ww  w.ja  va2  s  .c o m
}

Related

  1. convertLong(byte[] data, int offset)
  2. convertLong(long v, boolean isLE)
  3. convertLongAddressToBuf(long ipAddress)
  4. convertLongArray(long[] arr)
  5. convertLongArrayFromHex(char[] hex)
  6. convertLongArrayToDoubleArray(long[] values)