Java Byte to Unsigned Int asUnsignedShort(byte signedValue)

Here you can find the source of asUnsignedShort(byte signedValue)

Description

Converts an unsigned 8-bit value (represented by the signed byte data type) to a 16-bit short value.

License

Open Source License

Parameter

Parameter Description
signedValue the value, interpreted as unsigned

Return

an int containing the unsigned 8-bit value

Declaration

static short asUnsignedShort(byte signedValue) 

Method Source Code

//package com.java2s;
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

public class Main {
    /**/*w  w w .  ja v a  2  s . c  om*/
     * Converts an unsigned 8-bit value (represented by the signed byte data type) to a 16-bit short value.
     * The result represents a non-negative value within the range of 8-bit unsigned integers.
     *
     * @param signedValue the value, interpreted as unsigned
     * @return an int containing the unsigned 8-bit value
     */
    static short asUnsignedShort(byte signedValue) {
        return (short) (signedValue & 0xFF);
    }
}

Related

  1. asUnsignedByte(byte b)
  2. asUnsignedByte(int n)
  3. asUnsignedInt(byte b)
  4. asUnsignedInt(byte signedValue)
  5. asUnsignedLong(byte signedValue)
  6. asUnsignedShort(short s)
  7. byteToUByte(byte value)
  8. byteToUInt(byte b)
  9. byteToul(byte b)