Java Byte to Unsigned Int asUnsignedLong(byte signedValue)

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

Description

Converts an unsigned 8-bit value (represented by the signed byte data type) to a 64-bit long 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 long asUnsignedLong(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 .  j av  a2s.  c  o m
     * Converts an unsigned 8-bit value (represented by the signed byte data type) to a 64-bit long 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 long asUnsignedLong(byte signedValue) {
        return signedValue & 0xFFL;
    }

    /**
     * Converts an unsigned 16-bit value (represented by the signed short data type) to a 64-bit long value.
     * The result represents a non-negative value within the range of 16-bit unsigned integers.
     *
     * @param signedValue the value, interpreted as unsigned
     * @return an int containing the unsigned 16-bit value
     */
    static long asUnsignedLong(short signedValue) {
        return signedValue & 0xFFFFL;
    }

    /**
     * Converts an unsigned 32-bit value (represented by the signed int data type) to a 64-bit long value.
     * The result represents a non-negative value within the range of 32-bit unsigned integers.
     *
     * @param signedValue the value, interpreted as unsigned
     * @return an int containing the unsigned 32-bit value
     */
    static long asUnsignedLong(int signedValue) {
        return signedValue & 0xFFFFFFFFL;
    }
}

Related

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