Java Integer Create toInt(byte mostSignificant, byte leastSignificant)

Here you can find the source of toInt(byte mostSignificant, byte leastSignificant)

Description

Converts a pair of bytes to a int

License

Open Source License

Parameter

Parameter Description
mostSignificant The most significant number part
leastSignificant The least significant number part

Return

A int

Declaration

public static int toInt(byte mostSignificant, byte leastSignificant) 

Method Source Code

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

public class Main {
    /**/*from w ww.j av a2 s.  co m*/
     * Converts a pair of bytes to a {@code int}
     * @param mostSignificant The most significant number part
     * @param leastSignificant The least significant number part
     * @return A {@code int}
     */
    public static int toInt(byte mostSignificant, byte leastSignificant) {
        int n = 0;
        n ^= mostSignificant & 0xFF;
        n <<= 8;
        n ^= leastSignificant & 0xFF;
        return n;
    }
}

Related

  1. toInt(byte b)
  2. toInt(byte b1, byte b2, byte b3, byte b4)
  3. toInt(byte byte0, byte byte1, byte byte2, byte byte3)
  4. toInt(byte byte3, byte byte2, byte byte1, byte byte0)
  5. toInt(byte in0, byte in1, byte in2, byte in3)
  6. toInt(byte src)
  7. toInt(byte value)
  8. toInt(byte... b)
  9. toInt(byte... b)