Java Unsigned Number Create unsigned32ToBytes(long value)

Here you can find the source of unsigned32ToBytes(long value)

Description

unsigned To Bytes

License

Apache License

Declaration

public static byte[] unsigned32ToBytes(long value) 

Method Source Code

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

public class Main {
    public static byte[] unsigned32ToBytes(long value) {
        return toBytes(value, 4);
    }//  ww  w .  j a  v  a  2 s .  c  om

    public static byte[] toBytes(long value, int len) {
        byte[] array = new byte[len];
        for (int i = 0; i < len; i++) {
            array[i] = (byte) (value >>> ((len - i - 1) * 8));
        }
        return array;
    }
}

Related

  1. unsigned(byte value)
  2. unsigned(int num)
  3. unsigned(int val)
  4. unsigned(short value)
  5. unsigned16(short s)
  6. unsigned32ToInt(byte[] bytes)
  7. unsigned4BytesToInt(byte[] buf, int pos)
  8. unsigned8(byte b)
  9. unsigned_byte(byte b)