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

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

Description

bytes To Int

License

Open Source License

Declaration

public static long bytesToInt(byte[] data) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static long bytesToInt(byte[] data) {
        int offset = 0;
        int a1 = data[offset + 3] & 0xFF;
        int a2 = data[offset + 2] & 0xFF;
        int a3 = data[offset + 1] & 0xFF;
        int a4 = data[offset + 0] & 0xFF;
        return (a1) + (a2 << 8) + (a3 << 16) + (a4 << 24);
    }//www  .java  2 s. c o  m
}

Related

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