Java Unsigned Number Create unsignedNumericToByteArray(long src, int length)

Here you can find the source of unsignedNumericToByteArray(long src, int length)

Description

unsigned Numeric To Byte Array

License

Open Source License

Declaration

public static byte[] unsignedNumericToByteArray(long src, int length) 

Method Source Code

//package com.java2s;

public class Main {
    public static byte[] unsignedNumericToByteArray(long src, int length) {
        byte[] result = new byte[length];

        for (int i = 0; i < length; i++) {
            result[i] = (byte) (src >>> (length - 1 - i) * 8 & 0xff);
        }//from   ww w .ja  v  a  2  s  . c o  m

        return result;
    }
}

Related

  1. unsignedLong(byte b)
  2. unsignedLongToByteArray(final long value)
  3. unsignedLongToString(long value)
  4. unsignedLongToString(long x)
  5. unsignedMediumToBytes(final Long unsignedInt)
  6. unsignedOneSidedGallopingIntersect2by2(final short[] smallSet, final int smallLength, final short[] largeSet, final int largeLength, final short[] buffer)
  7. unsignedShort(byte b)
  8. unsignedShort(short s)
  9. unsignedShort2Arr(int var, byte[] arrayBytes, int startIndex)