Java Unsigned Number Create unsignedByteToInt(final byte b)

Here you can find the source of unsignedByteToInt(final byte b)

Description

Drop the sign bits in a byte for conversion to an int.

License

BSD License

Parameter

Parameter Description
b <code>byte</code> to be converted to an int.

Return

int which is the equivilant of the unsigned version of the byte param.

Declaration

public static int unsignedByteToInt(final byte b) 

Method Source Code

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

public class Main {
    /**/*from   ww w  .  j a v  a  2s.  co m*/
     * Drop the sign bits in a byte for conversion to an int.
     *
     * @param b
     *            <code>byte</code> to be converted to an int.
     * @return <code>int</code> which is the equivilant of the unsigned version
     *         of the <code>byte</code> param.
     */
    public static int unsignedByteToInt(final byte b) {
        return b & 0xFF;
    }
}

Related

  1. unsignedByteFromInt(int i)
  2. unsignedBytesToInts(Byte[] bytes)
  3. unsignedByteToInt(byte b)
  4. unsignedByteToInt(byte b)
  5. unsignedByteToInt(byte in)
  6. unsignedByteToIntArray(byte[] bytes)
  7. unsignedByteToLong(final byte b)
  8. unsignedByteToString(int i)
  9. unsignedByteValue(byte[] data, int offset)