Java Byte Array to Unsigned Int bytesToUint(byte first, byte second, byte third, byte fourth)

Here you can find the source of bytesToUint(byte first, byte second, byte third, byte fourth)

Description

bytes To Uint

License

Apache License

Declaration

public static int bytesToUint(byte first, byte second, byte third,
            byte fourth) 

Method Source Code

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

public class Main {
    public static int bytesToUint(byte first, byte second, byte third,
            byte fourth) {
        int firstI = (first & 0xFF) << 24;
        int secondI = (second & 0xFF) << 16;
        int thirdI = (third & 0xFF) << 8;
        int fourthI = (fourth & 0xFF);

        return firstI | secondI | thirdI | fourthI;

    }/*  ww  w .j ava  2  s.  c om*/
}

Related

  1. bytesToUInt(final byte[] bytes, final int position, final int length, final int bitShiftStart, final int bitShitIncrement)
  2. bytesToUIntLE(byte[] data)
  3. bytesToUIntLong(byte[] bytes, int index)
  4. bytesToUnsignedInt(byte ib1, byte ib2)