Java Integer Convert To convertIntFromBytes(byte[] byteArray)

Here you can find the source of convertIntFromBytes(byte[] byteArray)

Description

convert Int From Bytes

License

Open Source License

Declaration

public static int convertIntFromBytes(byte[] byteArray) 

Method Source Code

//package com.java2s;

public class Main {
    public static int convertIntFromBytes(byte[] byteArray) {
        return convertIntFromBytes(byteArray, 0);
    }// w  ww .  j  a  va 2 s .  c o  m

    public static int convertIntFromBytes(byte[] byteArray, int offset) {
        // Convert it to an int
        int number = ((byteArray[offset] & 0xFF) << 24)
                + ((byteArray[offset + 1] & 0xFF) << 16)
                + ((byteArray[offset + 2] & 0xFF) << 8)
                + (byteArray[offset + 3] & 0xFF);
        return number;
    }
}

Related

  1. convertIntegerToInt(Integer[] values)
  2. convertIntegerToTwoCharString(int integer)
  3. convertInteralNameToResourceName(String type1)
  4. convertInternalClassNameToQualifiedName(String className)
  5. convertInternalFormToQualifiedClassName( final String classInternalName)
  6. convertIntfwl(String[] idArray)
  7. convertIntList(Integer[] list)
  8. convertIntoRange(Integer inValue, int inSteps, int inMin, int inMax)
  9. convertIntToDayOfWeek(int day)