Here you can find the source of byteToUnsignedLong(byte data)
Converts the given byte's value to an unsigned long number.
Parameter | Description |
---|---|
data | the byte to convert. |
public static long byteToUnsignedLong(byte data)
//package com.java2s; /*//from w w w. j a v a 2 s . co m * This file is part of SerialPundit. * * Copyright (C) 2014-2016, Rishi Gupta. All rights reserved. * * The SerialPundit is DUAL LICENSED. It is made available under the terms of the GNU Affero * General Public License (AGPL) v3.0 for non-commercial use and under the terms of a commercial * license for commercial use of this software. * * The SerialPundit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ public class Main { /** * <p>Converts the given byte's value to an unsigned long number. The least significant byte (8 bits) of * the long number will be identical to the byte (8 bits) provided, and the most significant 7 bytes * (56 bits) of the long will be zero.</p> * * @param data the byte to convert. * @return An unsigned long number representing the given byte. */ public static long byteToUnsignedLong(byte data) { return 0x00000000000000ff & ((long) data); } }