Java Integer Create toInt(byte[] buf, int pos)

Here you can find the source of toInt(byte[] buf, int pos)

Description

to Int

License

Apache License

Declaration

public static int toInt(byte[] buf, int pos) 

Method Source Code

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

public class Main {
    public static int toInt(byte[] buf, int pos) {
        return toUnsignedByte(buf, pos) << 24 + toUnsignedByte(buf, pos + 1) << 16
                + toUnsignedByte(buf, pos + 2) << 8 + toUnsignedByte(buf, pos + 3);
    }//from ww  w .ja  v  a 2s. co m

    public static int toUnsignedByte(byte[] buf, int pos) {
        int b = buf[pos];
        if (b < 0) {
            b = 256 + b;
        }
        return b;
    }
}

Related

  1. toInt(byte[] block, int pos, int len)
  2. toInt(byte[] bRefArr)
  3. toInt(byte[] buf)
  4. toInt(byte[] buf)
  5. toInt(byte[] buf, int off)
  6. toInt(byte[] byteArray)
  7. toInt(byte[] bytes)
  8. toInt(byte[] bytes)
  9. toInt(byte[] bytes)