Java Integer From intFromBytes(byte[] buffer)

Here you can find the source of intFromBytes(byte[] buffer)

Description

int From Bytes

License

Open Source License

Declaration

public static int intFromBytes(byte[] buffer) 

Method Source Code

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

public class Main {
    public static int intFromBytes(byte[] buffer) {
        return intFromBytes(buffer, 0, 4);
    }//  w  w w  . j a  v a 2s. c om

    public static int intFromBytes(byte[] buffer, int startPosition, int length) {
        int result = 0;
        for (int idx = startPosition + length - 1; idx >= startPosition; idx--)
            result = (result << 8) | (((int) buffer[idx]) & 0xFF);
        return result;
    }
}

Related

  1. intFromByteArray(final byte[] buf, final int offset)
  2. intFromByteArray(final byte[] byteArray)
  3. intFromByteRGB(byte[] reds, byte[] greens, byte[] blues)
  4. intFromBytes(byte[] b)
  5. intFrombytes(byte[] b, int pos)
  6. intFromBytes(byte[] buffer, int offset)
  7. intFromBytes(byte[] bytes)
  8. intFromBytes(byte[] bytes)
  9. intFromBytes(byte[] bytes, int offset)