Java Byte to Unsigned Int byteToUnsigned(byte b)

Here you can find the source of byteToUnsigned(byte b)

Description

This function converts a byte into its unsigned integer form.

License

Open Source License

Parameter

Parameter Description
b The byte to be converted.

Return

The unsigned version of the byte as an integer.

Declaration

static public int byteToUnsigned(byte b) 

Method Source Code

//package com.java2s;
/************************************************************************
 * Copyright (c) Crater Dog Technologies(TM).  All Rights Reserved.     *
 ************************************************************************
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.        *
 *                                                                      *
 * This code is free software; you can redistribute it and/or modify it *
 * under the terms of The MIT License (MIT), as published by the Open   *
 * Source Initiative. (See http://opensource.org/licenses/MIT)          *
 ************************************************************************/

public class Main {
    /**/*from  w ww . j a v a 2 s .  c  o m*/
     * This function converts a byte into its unsigned integer form.
     *
     * @param b The byte to be converted.
     * @return The unsigned version of the byte as an integer.
     */
    static public int byteToUnsigned(byte b) {
        int unsigned = b & 0xFF;
        return unsigned;
    }
}

Related

  1. asUnsignedShort(short s)
  2. byteToUByte(byte value)
  3. byteToUInt(byte b)
  4. byteToul(byte b)
  5. byteToUnInt(Byte sByte)
  6. byteToUnsigned(byte b)
  7. byteToUnsigned(byte signed)
  8. byteToUnsignedByte(byte b)
  9. byteToUnsignedint(byte b)