Java Integer Create toInt(byte[] bytes, int offset)

Here you can find the source of toInt(byte[] bytes, int offset)

Description

to Int

License

Open Source License

Declaration

public static int toInt(byte[] bytes, int offset) 

Method Source Code

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

public class Main {
    public static int toInt(byte[] bytes, int offset) {
        int ret = 0;
        for (int i = 0; i < 4 && i + offset < bytes.length; i++) {
            ret <<= 8;/*from   ww  w .  jav  a  2 s  .co m*/
            ret |= (int) bytes[i] & 0xFF;
        }
        return ret;
    }
}

Related

  1. toInt(byte[] bytes)
  2. toInt(byte[] bytes)
  3. toInt(byte[] bytes, boolean isBigEndian)
  4. toInt(byte[] bytes, int index)
  5. toInt(byte[] bytes, int offset)
  6. toInt(byte[] bytes, int offset)
  7. toInt(byte[] bytes, int offset)
  8. toInt(byte[] data)
  9. toInt(byte[] data)