Java Unsigned Number Create unsigned32ToInt(byte[] bytes)

Here you can find the source of unsigned32ToInt(byte[] bytes)

Description

unsigned To Int

License

Apache License

Declaration

public static long unsigned32ToInt(byte[] bytes) 

Method Source Code

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

public class Main {
    public static long unsigned32ToInt(byte[] bytes) {
        return fromBytes(bytes, 4);
    }//www .java 2  s.c om

    public static long fromBytes(byte[] bytes, int len) {
        long v = 0;
        for (int i = 0; i < len; i++) {
            v += (long) (bytes[i] & 255) << (len - i - 1) * 8;
        }
        return v;
    }
}

Related

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