Java Byte Array Big Endian BytesBEToInt(final byte[] buf)

Here you can find the source of BytesBEToInt(final byte[] buf)

Description

Bytes BE To Int

License

Creative Commons License

Declaration

public final static int BytesBEToInt(final byte[] buf) 

Method Source Code

//package com.java2s;
//License from project: Creative Commons License 

public class Main {
    public final static int BytesBEToInt(final byte[] buf) {
        int val = 0x0;

        for (int i = 0; i < buf.length; i++) {
            val += ((int) buf[i] & 0xFF) << ((3 - i) * 8);
        }/*from w ww.j a  v  a  2s .  com*/

        return val;
    }
}

Related

  1. bytesBE2long(byte[] b, int off)
  2. BytesBEToFloat(final byte[] value)
  3. bytesHighFirstToChar(byte[] bytes, int start)
  4. bytesHighFirstToFloat(byte[] bytes, int start)
  5. bytesHighFirstToInt(byte[] bytes, int start)