Java Integer Create toInt(byte[] bytes)

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

Description

to Int

License

Apache License

Declaration

public static int toInt(byte[] bytes) 

Method Source Code

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

public class Main {

    public static int toInt(byte[] bytes) {
        int num = 0;
        if (bytes != null) {
            for (int i = bytes.length - 1, j = 0; i >= 0; i--, j++) {
                num += (long) (bytes[i] & 0xff) << (j * 8);
            }/*  ww w.j  a  va2s . co m*/
        }
        return num;
    }
}

Related

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