Java Byte Array to Int bytesToInt(byte[] data)

Here you can find the source of bytesToInt(byte[] data)

Description

bytes To Int

License

Apache License

Declaration

public static int bytesToInt(byte[] data) 

Method Source Code

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

public class Main {
    public static int bytesToInt(byte[] data) {
        return bytesToInt(data, 0);
    }//from   w ww  . j ava  2s . co m

    public static int bytesToInt(byte[] data, int offset) {
        assert (data.length - offset >= 4);
        return (data[offset]) | (data[offset + 1] << 1)
                | (data[offset + 2] << 2) | (data[offset + 3] << 3);
    }
}

Related

  1. bytesToInt(byte[] bytes, int offset, int length)
  2. bytesToInt(byte[] bytes, int start)
  3. bytesToInt(byte[] bytesSource)
  4. bytesToInt(byte[] data)
  5. bytesToInt(byte[] data)
  6. bytesToInt(byte[] value)
  7. bytesToInt(final byte[] arr)
  8. bytesToInt(final byte[] b)
  9. bytesToInt(final byte[] buf, final int offset)