Java Long to longToBigEndian(long value, byte[] in, int offset)

Here you can find the source of longToBigEndian(long value, byte[] in, int offset)

Description

long To Big Endian

License

Open Source License

Declaration

public static void longToBigEndian(long value, byte[] in, int offset) 

Method Source Code

//package com.java2s;

public class Main {
    public static void longToBigEndian(long value, byte[] in, int offset) {
        if (in == null) {
            throw new NullPointerException("in == null");
        }//from   w w w . ja  va 2s  . c  om
        if ((in.length - offset) < 8) {
            throw new IllegalArgumentException("not enough space in array");
        }
        in[offset] = (byte) ((value >> 56) & 0xff);
        in[offset + 1] = (byte) ((value >> 48) & 0xff);
        in[offset + 2] = (byte) ((value >> 40) & 0xff);
        in[offset + 3] = (byte) ((value >> 32) & 0xff);
        in[offset + 4] = (byte) ((value >> 24) & 0xff);
        in[offset + 5] = (byte) ((value >> 16) & 0xff);
        in[offset + 6] = (byte) ((value >> 8) & 0xff);
        in[offset + 7] = (byte) ((value) & 0xff);
    }
}

Related

  1. LongToAscii(long number, byte[] buf, int offset, int length)
  2. longToBaseCode(char[] target, int targetOffset, long value, int base, int lengthLimit, boolean fillZeros, boolean upperCase)
  3. longToBasicType(long l, Class clazz)
  4. longToBcd(long num, int size)
  5. longToBcd(long src, int len, int flag)
  6. longToBinary(long num)
  7. longtobinarystring(long wert, int bits)
  8. longToBinaryStringUnsigned(long value)
  9. longToBucket(long key, int buckets)