Java Unsigned Number Create unsignedIntToInt(byte[] b)

Here you can find the source of unsignedIntToInt(byte[] b)

Description

Convert a byte array to an unsigned int value

License

Open Source License

Parameter

Parameter Description
b byte array

Return

int value

Declaration

public static final int unsignedIntToInt(byte[] b) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  w w w  . j ava2s .c  o m
     * Convert a byte array to an unsigned int value
     * 
     * @param b
     *            byte array
     * @return int value
     */
    public static final int unsignedIntToInt(byte[] b) {
        int i = 0;
        i |= b[0] & 0xFF;
        i <<= 8;
        i |= b[1] & 0xFF;
        i <<= 8;
        i |= b[2] & 0xFF;
        i <<= 8;
        i |= b[3] & 0xFF;
        return i;
    }
}

Related

  1. unsignedIntArray2signedIntArray(int[] myIntArray, int numberOfBytes)
  2. unsignedIntersect2by2(final short[] set1, final int length1, final short[] set2, final int length2, final short[] buffer)
  3. unsignedIntersects(short[] set1, int length1, short[] set2, int length2)
  4. unsignedIntToByteArray(long value)
  5. unsignedIntToHex(int i)
  6. unsignedIntToLong(byte[] b)
  7. unsignedIntToLong(byte[] b)
  8. unsignedIntToLong(byte[] bytes)
  9. unsignedIntToLong(byte[] source)